Hi iam tried to programm in c but not to sucessful here i have simple source code and i need to make multiple letters in if (char) its displaying me (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;
}
It's just for fun Thank's
Aucun commentaire:
Enregistrer un commentaire