Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,862 questions

51,784 answers

573 users

How to check if two arrays are equal or not in C

1 Answer

0 votes
#include <stdio.h>
#include <string.h>
  
int main(void) {
    int arr1[] = { 5, 7, 98 };
    int arr2[] = { 5, 7, 98 };
      
    if (memcmp(arr1, arr2, 3 * sizeof(int)) == 0) {
        printf("Arrays are equal");
    } else {
        printf("Arrays are not equal");
    }
    
    return 0;
}
  
  
  
/*
run:
  
Arrays are equal
  
*/

 



answered Dec 24, 2020 by avibootz
edited Dec 25, 2020 by avibootz

Related questions

1 answer 159 views
3 answers 223 views
1 answer 99 views
1 answer 128 views
1 answer 251 views
...