Discussion Locked

This question is releated to C Langauge

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

What is the answer of the following and how it is comming:-

#include
#include
main()
{
char a='\101'
printf("%c",a);
}

8 replies

by iainsheppard

Don't quite know what you want to know. You've left a semi-colon off after char a='\101'; Also, if you're trying to store the character with ascii value 101 in a just do char a=101; You also don't need conio.h for what you're doing atm. Here is the correct program:

#include

void main()
{
char a=101;
printf("%c", a);
}

Hope this helps.

by ms_saini3302

I want to know about the answer of the program is given in the question and how it is comming it is not as normal as you are thinking. if i write a='\101' and a=101 these two statement is not same and you are saying it same. This I know a=101 is consider ascii value. But do not know what is in a when I write a='\101'

by gary_w

When you specify a value starting with a slash, that's an octal (base 8) number.
Octal 101 = 'A'.

This discussion is closed to new replies.