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 is OHNS Material and can anybody explain the Chemical & Physical Properties of Same. Which Technical Standard Book shows this Specification. Why can't we use En series instead of OHNS. Where it is specifically Used.
3 Answers Advanced Bolting Solutions,
As you achieve greater success with the company after some years, Will you like to be a shareholder in our company?
hi my name is ashok i have 55 per and 2 backlogs and one year left may i get above 60 pr
What is HPLC ? and define it.
what is 16 bit processor and what is 32 bit processor?how can we differentiate and identify or find that ?How they access data?
which collection enforces type safety?
What is the meaning of "co relation" and what is the value of "co relation" in the performance testing environment.
why java take 2 byte for charecter???
why unix commands simpler rather than complex task
what is difference between shell commands and shell scripting commands or both r same?
which is the proper pipe for salt water line
find the net id and host id of the following IPV4 117.34.3.8 and 132.57.8.6
0 Answers Green University of Bangladesh,