Can we specify variable field width in a scanf() format string? If possible how?

Question :

Can we specify variable field width in a scanf() format string? If possible how?

All field widths are variable with scanf(). You can specify a maximum field width for a given 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 the only way to specify a fixed field width with scanf().


Similar Questions


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz