01-28-2012, 02:57 PM
(This post was last modified: 01-28-2012, 02:58 PM by AceInfinity.)
(01-28-2012, 02:49 PM)Pacman-Nemtap Wrote: That's it, what is the char exactly used for in a program, to understand what someone puts in???
Like I mentioned, it depends. Perhaps you have a program where you need to iterate through a selection of letters from the alphabet to make a check as to whether a sentence contains certain values. For example, checking for vowels?
Otherwise if you have something like this, you can make it a char string:
Code:
int main()
{
char * str = "string value";
}
You're using a pointer here as type char, but this enables you to use a string value.
Otherwise you can use string:
Code:
int main()
{
string str = "my string";
}