0Day Forums
[C] Variables help - Printable Version

+- 0Day Forums (https://0day.red)
+-- Forum: Coding (https://0day.red/Forum-Coding)
+--- Forum: C & C++ (https://0day.red/Forum-C-C)
+--- Thread: [C] Variables help (/Thread-C-Variables-help)



[C] Variables help - oversanguinely432911 - 06-01-2011

hey i need some help with very simple variables in c, i understand numbers with variables e.g.
Hidden Content

but how to i use variables with word's. like in C++ you would use string, but what do i use in C.


RE: [C] Variables help - sheeting214763 - 06-01-2011

Hidden Content

:smile:

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

Hidden Content
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:

Hidden Content

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)