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 |
A,B and C can complete a piece of work in 10 days, then how many people are required to finish the whole work in 25 days? a) 10 days b) 15 days c) 20 days d) 22 days e) 25 days
why view is created in database
What is the significance of superconductors?
what is need of interface. what is the diff b/w interface and abstract class
Whet is KCFT and difference between CFM and KCFT
Please can any tell what is the difference between method overloading and overriding in c#.net ?
why hv u chosen this feild after doing btech engg?.
7 Answers Federal Bank, State Bank Of India SBI,
sir i know motor core length rotor od stamping slot area no of slot how to calculat wire size and no of turns and suitable hp
as we know that java is a platform independent language, but we need jvm for the same operating system why?
Hello sir i finished my BE computer 2009 batch. I'm not gud at programming like 0 knowledge and i'm not interested in it too . Except this programming field is anyother option to afford into a new one ??????? can anyone help me plz
write a progremme using function 0f prime no.?
WHAT IS MOST THE PARAMETER WILL BE INSTALL IN NEW VFD'S INSTALLATION ?
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)