#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(){
int n, i, check=0;
char first_name[20];
char current_name[20];
printf("Enter n, followed by n last names (each last name must be a single word):");
scanf("%d", &n);
scanf("%s", &first_name[20]);
for (i=1; i<n; i++){
scanf("%s", ¤t_name[20]);
if ( strcmp(first_name[20], current_name[20])==0)
check = 1;
}
if (check == 1)
printf("First name in list is repeated.");
else
printf("First name in list is not repeated.");
system("pause");
return 0;
}
I'm using Dev C++, the error I get is this:
23:9 [Warning] passing argument 1 of 'strcmp' makes pointer from integer without a cast [enabled by default]
The programs runs, but it crashes after I type a few names in.