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 |
How to configure gigabit port in 2950
hello sir,pls fdorward previous group-I exam papers .....
Draw the diagram showing the function stack, illustrating the variables that were pushed on the stack at the point when function f2 has been introduced . type def struct { double x,double y} point; } main( int argc, char *arg[3]) { double a; int b,c; f1(a,b); } f1(double x, int y) {point p; stack int n; f2(p,x,y) } f2(point p, double angle) { int i,j,k,int max;
difference between a for loop and a while loop? what are its uses in c language?
THESE POSTS ARE FOR THE DURATION OF FIVE YEARS. AFTER COMPLETION OF FIVE YEARS, THE PERSONNEL POSTED AGAINST THESE POSTS ARE LIKELY TO BE CONTINUED IN NIC. CAN Any body say that what it will be happened after 5 years? does they through us out from NIC? Is it a temporary job of 5 years is the probation period?
Describe VCO?
java support which type of polymorphism??runtym or compile tym or both??
explain software engineering practices
why unix commands simpler rather than complex task
how will u recieve idoc
I want to know the relation between GI pipe ID, water flow rate in lpm, static head and friction head losses, motor kw for that flow etc.
Which of the following statements are true about constructors and methods? 1)A constructor has it's own name, a return type and is invoked using the new operator. 2)A function has it's own name, a return type and is invoked using the dot operator. 3)A constructor has the name of the class, no return type and is invoked using the new operator.