How to add double quotes in the output of C

So usually the double quotes around the variable don’t print out in the onput.

int main()
{
char CharAge[] = “1098A”;
printf(“%s”, CharAge);
return 0;
}

The output will be 1098A without the double quotes.

To add in the double quotes we need \” to bring the double quotes in the output.

int main()
{
char CharAge[] = “\”1098A\””;
printf(“%s”, CharAge);
return 0;
}

This time the output will be “1098A” with the double quotes.



Leave a comment

Design a site like this with WordPress.com
Get started