468,463 Members | 2,030 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,463 developers. It's quick & easy.

Number for space character in C

144 100+
Hai friends....

In C

for 97=A character , 65=a charcter....can u tell what is the number for "space" character...

Davidson
Apr 5 '08 #1
8 22937
questionit
553 512MB
Hai friends....

In C

for 97=A character , 65=a charcter....can u tell what is the number for "space" character...

Davidson
Hi Davidson

Wouldn't it be a good idea if you attempt to write a little and handy C program that will give you code for any character you enter in the program?

Anyway, Ascii code for space is 32.

Good luck with the program and learning C

Qi
Apr 5 '08 #2
JosAH
11,448 Expert 8TB
Hai friends....

In C

for 97=A character , 65=a charcter....can u tell what is the number for "space" character...

Davidson
Why do you even want to know that? A space character is simply this: ' '.
Any numerical value is bound to be valid only for a certain character encoding
such as ASCII or EBCDIC; if you want to sprinkle those numerical values all
over in your code it is doomed to be tightly coupled with that one single
character encoding scheme. Better stay far away from such bad practices.

kind regards,

Jos
Apr 5 '08 #3
davidson1
144 100+
Thank u josh..questionit.....

i need about that character because...i am doing project....i want allow the user to enter only characters....ie the name...other he could not enter any thingelse

....
(eg)

raja kumar

ravi kumar

only space and character can only enter by user...that is what..

As 32 was correct...for space that was send by questionit...

i need to know what is the number for [

i need to know what is the number for ]


pl help me..

Davidson
Apr 5 '08 #4
Ganon11
3,652 Expert 2GB
You can find them out easily enough by writing a program to output '[' and ']' as integer values. Store them as a char, then (if you are working in C), use the %d specifier to print them out with printf. In C++, typecast the chars to ints before cout-ing them.

But, as Jos said, if you are writing your program to compare a character to 32 to see if it is a space, it will only work on your computer and computers with similar character codes. Instead, you can just compare it to the character literal ' ', which will get the proper character no matter what system.
Apr 5 '08 #5
Why do you even want to know that? A space character is simply this: ' '.
Any numerical value is bound to be valid only for a certain character encoding
such as ASCII or EBCDIC; if you want to sprinkle those numerical values all
over in your code it is doomed to be tightly coupled with that one single
character encoding scheme. Better stay far away from such bad practices.

kind regards,

Jos
how should i do it for carriage return?
Apr 5 '08 #6
Ganon11
3,652 Expert 2GB
A carriage return character is '\r', and a newline character is '\n'.
Apr 5 '08 #7
davidson1
144 100+
Thank u friends...

do u know any website.........which contain all the numbers for charcters..........

pleas send that website.........

it will be useful to be.................

Davidson
Apr 5 '08 #8
Laharl
849 Expert 512MB
There's ASCII tables all over the internet, www.ascitable.com is one, as for EBCDIC, just Google it.
Apr 5 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by mr_burns | last post: by
12 posts views Thread by levent | last post: by
4 posts views Thread by Vig | last post: by
13 posts views Thread by fool | last post: by
23 posts views Thread by neha_chhatre | last post: by
1 post views Thread by Brock | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.