answersLogoWhite

0


Best Answer

Yes, you can specify variable width, however you can't specify precision. The format tags are as follows:


scanf: %[*][width][length]type

printf: %[*][width][.precision][length]type


As you can see, scanf lacks the precision tag but does include the length tag.

See: http://msdn2.microsoft.com/en-us/library/kwwtf9ch.aspx

User Avatar

Wiki User

โˆ™ 2017-02-12 18:18:42
This answer is:
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
User Avatar

Add your answer:

Earn +20 pts
Q: Can you specify variable field width in scanf format string?
Write your answer...
Submit
Related questions

Can you specify variable field width in a scanf format string?

ftghdd ftghdd ftghdd ftghdd


Can you specify variable field width in a scanf format string If possible how?

AnswerYou 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.AnswerIf you want to specify a variable width in a printf format string (as opposed to scanf), you can do the following:printf("%*d", width, num);That will use the value of "width" as the width for formatting the value of "num" as a decimal integer.


In IPv6 each address contains an or a variable-length field at the beginning of the address that indicates what type of address it is?

format prefix


What is variable field length?

The amount of data stored in such fields can vary in length. Usually you do specify a maxmimum length so that databases can optimize how data is stored and accessed.


What characteristics in a database fields may have such as data type field name field size and field format?

What characteristics could a database field have, such as data type, field name, field size and field format?


How can you call a function given its name as a string?

we have to construct a table of two field structures,where the first field is the funtion name as a string and the second field is just the function name.then search the table to get a string match in the first field and use the second field to call the function.


In craps which of these numbers is NOT in the field?

You didn't specify which numbers. The field numbers are 2,3,4,9,10,11,12. The numbers that are not in the field are 5,6,7,8


What is the indicates the type of data that can be stored in a field?

The data type of the Variable determines/indicates the type of data that can be stored in a field/variable


What is instance variable in java?

That refers to a variable attached to an object - also known as a field.


What does Error converting data type to numeric means?

You must have declared a method which tries to convert a variable/field value into a numeric value but that is not possible. Refer to the line on which the error is found and remove the method which tries to convert the variable/field. Note: Java allows type casting so a string cannot be converted into integer even if a method tries to change the value


How do you validate empty fields in PHP?

PHP provides a function called empty($var), which tests if $var is "empty." Empty has an odd definition, since the function returns true if the variable loosely equates to False. Although a zero-length string would be considered empty, so would the string "0" (among other irrelevant values).To accept the value "0" from a field, use strlen($var). It tests the length of any variable, after casting it to a string. If this function truly equals integer zero (compared with triple-equals), the variable must be empty.


What is the unique name called for a data field?

String


When designing a table why is it important to place field properties within each field?

Fields specify how a field can work, what kinds of data can be put in to a field size and other things. You need to specify formats for numbers and dates. You need to specify the size of text fields. There are many optional properties which can prove useful in different situations. Doing validation on a field can be useful to reduce errors. You can ensure data is entered into a field. There are so many other things that properties do. So they are an essential part of designing a field in a database.


What is the difference between a field and data type?

A data type defines the properties associated with a name (a variable, a class or a function). A field is a member variable of a structured data type.


How do you plow?

Tie the string to the ox and make it run in the field.


Who is the field marshal of air force at present?

Please specify which country you are referring to.


What are Michio Kaku's major contributions?

His largest contribution is co-founding String field theory, which is a variation of String theory.


How do you sort string values by field calculator in ArcMap?

For example, there are few string values of "1-5", ">5", "0-0.9", and "<0" from one field in attribute table. Then I need to sort both "1-5" and ">5" to a new field. How do I make the field calculator for this? Thank you!


How is wind energy used to make electricity?

Most likely they are using permanent magnates to create variable magnetic field due to spinning propeller. According physics laws variable magnetic field causes electric current in a conductor subjected to the field.


What do employers mean when they have a field for Automated Word Processing Specify Equipment on a job application?

it means to specify what kind of equipment for example a typewriter, laptop, or desktop computer


What is the string theory by michio kaku?

Michio Kaku did the 'String Field Theory' with the other scientist from Japan. All Michio Kaku did was make the equation of String theory to about 1 inch long.


What resume format is best if you have little or no work experience?

If you have little experience or you want to change the field you can make use of functional resume format.


Does a capacitor store energy in the form of magnetic field?

inductor stores enerny in magnetic field while Capacitors stores energy in electric field format.


What is a field in java?

A field is an attribute. A field may be a class's variable, an object's variable, an object's method's variable, or a parameter of a function. class bike{ static int bikes;int gear;int cadence; void create( int newGear, int newCadence ){bikes = bikes + 1;gear = newGear; cadence = newCadence;} int getSpeed(){int speed = gear*cadence*5*3.141;return speed;}} 'bikes' is a class's variable (class variable) (static field). 'gear' and 'cadence' could be an object's variables (instance variables) (non-static fields). 'speed' is an object's method's variable (local variable). 'newGear' and 'newCadence' are parameters of a function (parameters). Refer to related links section


Who was number one on 1st September 1985?

It would help enormously if you could specify what field.