i have started learning c for 1 week and i am using VS 2005.
from tutorials i learned that size of char is 1 byte
i am using 32bit system
but i tried this program:
a=0xfffffffffffffffe; //now a is holding 8bytes thst is sizeof a double datatype
printf("size of varaible A:%d\n",sizeof(a));
printf(value in a is:%x\n value in b is:%x);
- void main()
size of varaible A:1
value in a is:fffffffe
value in b is:ffffffff
my question are:
1)when i added one more f in "a" variable a=0xfffffffffffffffef then when i compiled it showed me the error constant too big(bcoz its more than 32 bit) then why it didnot show earlier this erro message when i assigned value(0xfffffffffffffffe) to char a which greater than it can hold ie 0xff(1 byte size maximum valu that char can hold)
even if "A" has holded the whole 8 bytes in it then why did take only last 4 bytes for calculation?
Or VS 2005 itself expands the datasize from char to float or double ?