I need to add quotes in begging and ending of a char.
char *Mychar = "hello";
printf("%c\n",Mychar[0]);
My result is h
and my desired result is 'h'
.
Just add them in the format string. For single quotes, you can just put them in there:
printf("'%c'\n",Mychar[0]);
For double quotes, you'll have to escape them:
printf("\"%c\"\n",Mychar[0]);