I tried to program in C but was not sucessful. I have a simple source code and I need to match multiple letters in if (char)
. It's displaying the following error message (in linux terminal using gcc):
main.c: In function `main': main.c:16:23: warning: character constant too long for its type [enabled by default]
if (firstName[20] == 'Vojta'){
Source code:
#include <stdio.h>
int main(int argc, char const *argv[])
{
/* code */
char firstName[20];
char lastName[40];
char password[20];
char confpasswd[20];
int age;
printf("Please write your first and last name:");
scanf("%s%s", firstName, lastName);
printf("%s %s:\n", firstName, lastName);
if (firstName[20] == 'Vojta'){
printf("\ncool\n");
}
return 0;
}