Mega Code Archive

 
Categories / C / String
 

String compare

#include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]) {   if(argc!=3) {     printf("Incorrect number of arguments.");     exit(1);   }   if(!strncmp(argv[1], argv[2], 8))     printf("The strings are the same.\n");   return 0; }