hi,
why does this print 53?Code:void main()
{
printf("%d",'\65');
}
Thanks
Vikranth.
Printable View
hi,
why does this print 53?Code:void main()
{
printf("%d",'\65');
}
Thanks
Vikranth.
This is a question on a test/assignment or similar, isn't it?
What do you THINK it should print? What do you know about the meaning of '\nnn' character forming?
--
Mats
Hi Mats,
i havent cum across that \nn formatting
can u please tell me how it works??
So, explain to me what you THINK it does. f you don't know at all, perhaps you can look up "character constants" in your C book?
Just to clarify your "doubt" - there is no doubt here: the code is doing exactly what it should - it is only "unexpected" if you don't quite understand what the form of '\nnn' is doing.
--
Mats
Ok, so if we have:
does that simplify things?Code:int x = '\65';
--
Mats
Hi
\ddd where ddd is octal here.So u can use only the numbers from 0-7
And the logic is octal numbers are converted back to int(base 10) when printing.
Hope this helps
Praveen SP
> void main()
If your book told you to do this, you need a different book.