C Program to compare arrays

Problem Statement

You need to write a program in C to compare two arrays of characters and display if they are equal or not.

How to compare two arrays in C ?

#include <stdio.h> 
#include <string.h> 
int main() 
{ 
     char arr1[35], arr2[35]; 
     printf("Please enter the 1st string\n"); 
     gets(arr1); 
     printf("Please enter the 2nd string\n"); 
     gets(arr2); 
    
     printf("Entered strings are\narr1 = %s \narr2 = %s", arr1, arr2); 
  
     if( strcmp(arr1,arr2) == 0 ) 
          printf("\nEntered strings are equal.\n"); 
     else 
          printf("\nEntered strings are not equal.\n"); 
     return 0; 
}
%d