What value should be assigned to an integer in order to get a blank value displayed by printf
in return when that integer is passed as an argument to it?
Although I assign a null value to the integer it prints 0
Can someone please suggest what can be done to achieve this?
Thank you
If you are instructing printf()
to print an integer, there is no integer value that is represented by the empty string. There is no "null value" in the integer context, NULL in C is explicitly defined as being a zero value in pointer context. In integer context, 0
is simply a value. As for what should be done, use a conditional test to determine whether to call printf()
or not, or use a conditional test to choose between using printf()
to display an integer and using printf()
(or another function) to display a string of spaces of some appropriate length.