+ 3
How does the output comes as 8 in this code
Doubt in output https://code.sololearn.com/cqt5AU0c8bnm/?ref=app
5 Réponses
+ 6
This is because numeric constants beginning with a 0 are interpreted as octals numbers ( base 8 ) which when converted to decimal (base 10) (via the format specifier "%d") yields 8 as answer
+ 7
https://www.codeproject.com/Questions/997556/Why-are-the-outputs-different-in-C#:~:text=you%20are%20setting%20the%20variable,for%20the%20decimal%20value%208%20.
May this helps 🤔
+ 3
Yogeshwaran you can't do that directly in C, you have to write your own function to do perform conversion.
Here is an example ( I used bitwise operations here but you can also go for conventional method )
https://code.sololearn.com/cynQpl8R7b1q/?ref=app
+ 1
Thank you Arsenic ☺️👍