How to print % inside s(w)printf()?

  • Thread starter Thread starter ananda vardhana
  • Start date Start date
A

ananda vardhana

Guest
int main(void)
{
char msg[100];
sprintf(msg, "100%%\n");
printf(msg);

wchar_t msg1[100];
swprintf(msg1, L"100%%\n");
wprintf(msg1);

}

The above program had been working in the past now it has stopped? I am using C++ in Visual Studio 2017. Both the above prints just 100. What am I missing? Please enlighten. I tried various escape chars and quotes nothing worked.

thanks

ananda

Continue reading...
 
Back
Top