hi,
why does this print 53?Code:void main() { printf("%d",'\65'); }
Thanks
Vikranth.
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Ok, so if we have:
does that simplify things?Code:int x = '\65';
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.