i defined
on this line i getCode:char opt[254];
|55|warning: char format, different type arg (arg 2)|
what that means??Code:scanf("%s",&opt);
This is a discussion on what this warning means.. within the C Programming forums, part of the General Programming Boards category; i defined Code: char opt[254]; on this line i get |55|warning: char format, different type arg (arg 2)| Code: scanf("%s",&opt); ...
i defined
on this line i getCode:char opt[254];
|55|warning: char format, different type arg (arg 2)|
what that means??Code:scanf("%s",&opt);
&opt is not a pointer to char, which you need for the %s format specifier. You should use a pointer to char (in this case, "opt").
and as a side note - you should limit a number of chars that could be read by the format - to prevent buffer overrun
scanf("%253s",opt);
If I have eight hours for cutting wood, I spend six sharpening my axe.
what will happen to the program if the user will enter 254 chars?
Your head will twist right off your body, and zoom into outer space!!
Try it and see.
The program will format your hard drive, too!
http://apps.sourceforge.net/mediawik...Buffer_overrun
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^