# new baby doubt

This is a discussion on new baby doubt within the C Programming forums, part of the General Programming Boards category; can u tell me the diffrence b/w char a='1'; and char a=1; and can u tell me wht it means ...

1. ## new baby doubt

can u tell me the diffrence b/w
char a='1';
and
char a=1;
and can u tell me wht it means
int i = 0x1234567

thank u
sree

2. Print them both and find out?

3. can u tell me the diffrence b/w
char a='1';
and
char a=1;
In ASCII, '1' has the value of 49.

and can u tell me wht it means
int i = 0x1234567
The 0x prefix specifies that the number is expressed in hexadecimal, i.e., 0x1234567 == 19088743.

4. Originally Posted by cnu_sree
can u tell me the diffrence b/w
char a='1';
and
char a=1;

Code:
```char a='1';

printf("%c",a); //prints 1```
Code:
```char a=1;
printf("%c",a); //prints character with ASCII value 1```

Originally Posted by cnu_sree
can u tell me the diffrence b/w
char a='1';
and
char a=1;
and can u tell me wht it means
int i = 0x1234567

thank u
sree
Hai Sree,

char a='1'--> This is the correct way of initialising character & if you print this means you
char a=1--> it will give garbage value

int i=0X1234567-->Storing address directly into varible i

hope you understood,..

6. char a=1--> it will give garbage value
It is not a garbage value. It so happens that the char with value 1 is not printable.

int i=0X1234567-->Storing address directly into varible i
You are mistaken. 0X1234567 is just an int literal.

7. ## hello

Originally Posted by laserlight
It is not a garbage value. It so happens that the char with value 1 is not printable.

You are mistaken. 0X1234567 is just an int literal.
yes i am sorry it is only Hex representation of Decimal number right??

8. Yes, it's a number in hex format. 0x1 and 1 is the same thing - both numbers (and in this case, also translate to the same base 10 number).