Thursday, July 9, 2009

C programming?

can someone please give me a program, in which if i give a character input,it must return its ascii value.


smlarly covert ascii to characters.thanks for your help in advance

C programming?
i don't remember programming in C so mush ... but i know that if u read a characted as an input ... just print it as a decimal like this, u will get the ascii value:





char x;


scanf("%c",%26amp;x);


printf("%d",x);





to convert the ascii to characters, do the reverse:





int y;


scanf("%d",%26amp;y);


printf("%c",y);
Reply:Yup, what Mena has said will work, it's that simple. Depending on how you print it it'll be ascii or the char equivalent

peacock plant

No comments:

Post a Comment