+ 2
String is used for only words or it is used for numbers ???
4 Antworten
+ 3
Arrays can be of any type.
An array of characters that is NULL terminated (i.e. contains '\0') is commonly referred to as a string.
Answering to your question: it is only for words.
+ 3
You can use numbers in a c-style string...eg "1234"...but it's still a string so you can't do any arithmetic on it, you'll need to convert it to in integer type first using e.g.... atoi().
+ 1
Strings can contain alphanumeric (A-Za-z0-9) and special characters (&#*:;'!-+.")
+ 1
There is no purely string in C, but there is char[] which you can use look-alike string. It's different from C++ which "string" does exist and in Java "String". I assume you get that already, answering your question, it can be used for numbers BUT the numbers are just as characters (visually a number, but it's actually a character, not a number), and not only words, it could be symbols as well.