Write a program that checks whether 2 strings are identical or not. 


Difficulty level
This exercise is mostly suitable for students
#include <stdio.h>
#define MAX 20

void main()
{
	char C1[MAX],C2[MAX];
	int i;

	printf("Enter the first string:\n");
	gets( C1 );
	printf("Enter the second string:\n");
	gets( C2 );

   	i=0;
   	while ((C1[i]==C2[i]) && (C1[i]!='\0') && (C2[i]!='\0'))
      		i++;

   	if((C1[i]=='\0') && (C2[i]=='\0'))
      		printf("Equal strings\n");
   	else
     	 	printf("Diffferent strings\n");
}

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Number of occurrence of a string into another one