I am trying to take Command line input for my program; where I am giving a multicharacter input! The program works well for a single character input ./a.out b
, but shows an error message for multi-character input! ./a.out bf
.
I am facing problem in dereferencing and comparing that input! May someone kindly help me with this! Thanks
I/O input : ./a.out bf
Code:
int main(int argc, char* argv[])
{ char bf = 'N';
if (argc>=2){
if( *argv[1] == 'bf') # line with problem
{
char bf = 'Y';
printf(" \n Bellmann-ford is in action! \n");
}
}
return 0
}
Error message:
main.c:6:6: warning: multi-character character constant [-Wmultichar]
if( *argv[1] == 'bf')