why is the output like this ?

#include<stdio.h>

#define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0]))
#define PrintInt(expr) printf("%s : %d \n" , #expr , expr)

void main()
{
int pot[]={0001,0010,0100,1000};
int i;

for(i=0;i<SIZEOF(pot);i++)
PrintInt(pot[i]);

return 0;

}

Why is output like this ?
pot[0]:1
pot[1]:8
pot[2] 64
pot[3]:1000

When you start a number with 0, it's in base 8. (When you start it with 0x, it's in base 16).
Topic archived. No new replies allowed.