Mar 10 in C++
Q: Can we specify variable field width in a scanf() format string in C Language? If possible how in C Language?

1 Answer

Mar 10
All field widths are variable with scanf(). You can specify a maximum field width for a


field by placing an integer value between the =%‘ and the field type specifier. (e.g. %64s). Such a

specifier will still accept a narrower field width.

The one exception is %#c (where # is an integer). This reads EXACTLY # characters, and it is


only way to specify a fixed field width with scanf().
Click here to read more about C++
Click here to read more about Insurance

Related questions

Mar 12 in C++
Jun 11 in C++
Mar 12 in C++