As it is said in the title i can not get the keyword string. I finally found a version of C for windows 8 but now i can t get the most important thing types int, double char,bool ect... work perfectly and always show as a keyword but somehow i can not get string.

4 Years
Discussion Span
Last Post by Ancient Dragon

C doesn't have a string type. Can you be more specific about what you're trying to do? Perhaps post a sample program?


I feel now kind of weird like my mind got erased in a second (started C at high school -.-) maybe because i m working in c# and now java for quite a time and suddenly switched to C and wondering where data type string is. Tnx @deceptikon


As deceptikon said, C language does not have a string data type. Instead, it uses character arrays. For example if you want it to hold the word "Hello" then the character array has to room to hold at least 6 characters -- 5 for "Hello" and another for the terminating character which is '\0';

char string[6];

This declares a character array named "string" that can hold 5 characters plus null-terminating character. You can name the array anything you want, it doesn't really matter as long as the name is unique (can't duplicate the name of something else in the program).

Edited by Ancient Dragon

Votes + Comments
tnx for the additional reply
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.