can we specify variable field width in a scanf() format
string? if possible how in c language?
Answer / deepedra kushwaha
You can't specify a variable field with a fixed format
string, but you can get around this by making the format
string variable:
int width;
char format[20]; /* or whatever size is appropriate */
int value;
...
sprintf(format, "%%%dd", width); /* generates a string like
"%5d" */
scanf(format, &value);
The only drawback to this method, other than requiring two
statements, is that the compiler can't do a sanity check on
the arguments to scanf like it can when the format is a
string constant.
Read more:
http://wiki.answers.com/Q/Can_you_specify_variable_field_width_in_a_scanf_format_string_If_possible_how#ixzz1bSMgbeUL
| Is This Answer Correct ? | 1 Yes | 0 No |
what do you mean by a p-code?
Is there aptitute question will be asked in NIC exam ??? If yes how many questions will be asked??
what is PPM,CM & EM in FM company
Describe an impedance matching circuit?
Hello everybody, I have applied for the AAI jr executive ATC exam. I am from CSE branch. Is Exam paper for the CSE and other branches same or not? Because I don't have knowlwdge on Electronic subject? Can any one please send me the previous exam papers for AAI Jr Executive of CSE branch My id is: naveen.kocherla@gmail.com Thanks and Regards Naveen
376,188,88,40,16,4,-2. Find wrong term in series
any one can help me to know the top mnc companies and their working platforms?i mean java,php...
Why do windmills never appear stationary?
I am having 17 months experience in development.I want to take testing as my career.I dont have experience in testing. Will get job anywhere?
What is the most important thing to know about marine engineering?
please send me latest Aptitude Test paper
15. What is your Future Plans for the Company if Permanently Employed?
Civil Engineering (5086)
Mechanical Engineering (4456)
Electrical Engineering (16639)
Electronics Communications (3918)
Chemical Engineering (1095)
Aeronautical Engineering (239)
Bio Engineering (96)
Metallurgy (361)
Industrial Engineering (259)
Instrumentation (3014)
Automobile Engineering (332)
Mechatronics Engineering (97)
Marine Engineering (124)
Power Plant Engineering (172)
Textile Engineering (575)
Production Engineering (25)
Satellite Systems Engineering (106)
Engineering AllOther (1379)