Hi,
I would like to print the ascII value of the letter p using the variable Mychar. Using a printf() statement is this the correct format.
char MyChar;
MyChar ='p';
printf("The value of %c in octal is %#0\n",'MyChar');
thanks
Hi,
I would like to print the ascII value of the letter p using the variable Mychar. Using a printf() statement is this the correct format.
char MyChar;
MyChar ='p';
printf("The value of %c in octal is %#0\n",'MyChar');
thanks
No. Don't put your variable name in single quotes.
printf("%c is %d", MyVar, MyVar );
Read up on printf and its format specifiers.
Quzah.
Hope is the first step on the road to disappointment.
you coulda cut out the variable by just directly putting 'p' as the 2nd param of printf. 'MyVar' and MyVar are two different things. 'MyVar' is illegal, but you might have meant "MyVar" which is a string. MyVar is a variable/constant with meaning.