Doubt in using % symbol under sprintf
I got a requirement of changing the display string in one of the application. It is something like changing "90 percentage CPU" to "90% CPU". First, i did the fix in one of the printf by doing
Then, i need the same changes under sprintf so i tried
But, when i tried to print the "str" i am getting the result as %s. So, i searched and found in some forum they suggested to use double % symbol like the following
With this change it is correctly printing %CPU. Can someon explain me how this intertpretation works under sprintf?