confusing C question

Can anyone explain me why, i is considered as an octal number in this code?


#include
int main() {
int i = 0100;
printf("%d",i);
}

Replies

  • Jeffrey Arulraj
    Jeffrey Arulraj
    Simple

    The first letter '0' indicate the compiler that the number is an OCTAL number
    '0x' indicates Hexa decimal number
  • Vishal Sharma
    Vishal Sharma
    Jeffrey Samuel
    Simple

    The first letter '0' indicate the compiler that the number is an OCTAL number
    '0x' indicates Hexa decimal number
    and 0b for binary... Its same like MCU's 😛 didn't think in that way! thanks!
  • Jeffrey Arulraj
    Jeffrey Arulraj
    Vishal0203
    and 0b for binary... Its same like MCU's 😛 didn't think in that way! thanks!
    It seems '0b' will do that for you mate

You are reading an archived discussion.

Related Posts

Is there any way to connect RPi & Arduino over serial GPIO without using Dual-Logic Level converter (5.0V <-> 3.3V) ? If there's any then kindly teach me the method....
Hello I have three Led's with forward drop of 1.7 V and 10 milliamp current. I am using 9 V battery with 15 miliamp. I used this website that gave...
Hi CEans, I want to know whether there is any camera out there which has the power or capacity of eye. What is the maximum megapixel of camera available in...
I used Galaxy s4 How it works about Eye Gesture, Finger Gesture technology. Can you Explain me how it works Thanks...
where to create @crazyengineers.net mail id?