Mega Code Archive

 
Categories / C / String
 

Compare two strings

#include <stdio.h> #include <string.h> int main () {   char szKey[] = "Apple";   char szInput[80];      do {         printf ("Which is my favourite computer? ");      gets (szInput);      } while (strcmp (szKey,szInput) != 0);      printf ("Correct answer!\n");   return 0; }