Login Register


[C] Variables help filter_list
Author
Message
[C] Variables help #1
hey i need some help with very simple variables in c, i understand numbers with variables e.g.
Code:
int num; num = 10;

but how to i use variables with word's. like in C++ you would use string, but what do i use in C.
[Image: 6caf54.gif]

Reply

RE: [C] Variables help #2
Code:
char i = 'Hi';

Smile

Also, for your code, its better if you do:

Code:
int num = 10;
it keeps the program small without useless lines Smile

NOTE: Characters in C are stored with their ASCII value. With that, you can do pretty funny things. For example this little program:

Code:
main() { int c; char a = 'a', b = 'b'; c = a + b; printf("%d", c); }

It may look like nonsense. Because 'c' is an integer and 'a' and 'b' are characters.
But if you run the program, you will find out, that in the end, we simply add just the ASCII values, so this program is working Smile (it can work other way around too, you can convert integer into char. However, you cannot convert float to char)
Staff will never ever ask you for your personal information.
We know everything about you anyway.

Reply







Users browsing this thread: 1 Guest(s)