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

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

It is possible to specify variable field width in a scanf() format string. By using %s control string. This character reads a string of variable field width up to the first white space character.

Ex: scanf(ā€œ%sā€, name); // where name is a character array

Out of fgets() and gets() which function is safe to use and why?
The function fgets() function is safer to use. It checks the bounds, i.e., the size of the buffer and does not cause overflow on the stack to occur......
Difference between strdup() and strcpy()
The function strcpy() will not allocate the memory space to copy. A pointer to the string to copy and a pointer to place to copy it to should be given.....
What is the difference between char *a and char a[]?
For char[] array, such size is not accepted by the compiler. If the size is specified, the following are the differences between char *a and char a[]......
Post your comment