Ab said:
What does the "%%" format specifier in scanf do? eg if we write
char ch;
scanf("%%", &ch);
what change if any does it make to ch. If it does not whats the use.
You are reading some economics data, which contains inflation rates. Since
there are many definitions of inflation, the economist has prepared the data
by appending letters, so for instance Keynes'es definition is 2.6%k whilst
Friedman's definition is expressed as 2.6%f.
If you try to scan this data using scanf(), the %f will be interpreted as a
format conversion specifier. So you need to escape the % sign to indicate
that it is a percentage in the text, not a field specifier. To make it
easier, the %k also has to be escaped.