I know that period . symbol separates field width with precision. But, I am not getting how the zero is coming after %. Every time I am running it is showing the same output.
The code:
#include <stdio.h>
int main() { printf("%. %. %. "); return 0; }
Output: %.0 %.0 %.0
main.c:13:15: warning: unknown conversion type character 0x20 in format [-Wformat=]
main.c:13:18: warning: unknown conversion type character 0x20 in format [-Wformat=]
main.c:13:21: warning: unknown conversion type character 0x20 in format [-Wformat=]
You didn't supply a valid conversion specifier after
%(e.g.d,x,f,g,c,s,p, among others) so you're invoking undefined behavior. That means anything can happen.From section 7.19.6.1/9 of the ISO C99 standard: