J
Jack
Hi,
I am having some problems with char and string datatypes.
Here is an example
int main(){
string str;
cout << "enter string: ";
cin >> str;
}
Is there a way to go look at the 3rd char of the str. So something
like str[2].
What if we have:
int main (int argc, char * argv[])
How do you look at the third char in argv. do u use **argv or
*argv[3].
just use argv[].
Another question I have lets say you have the following.
int main(){
char * word;
cout << "enter word: ";
cin >> ......
can I some how use malloc or calloc to store the response and return a
pointer to word?
Thanks
J
I am having some problems with char and string datatypes.
Here is an example
int main(){
string str;
cout << "enter string: ";
cin >> str;
}
Is there a way to go look at the 3rd char of the str. So something
like str[2].
What if we have:
int main (int argc, char * argv[])
How do you look at the third char in argv. do u use **argv or
*argv[3].
true then *argv[] is a pointer to a pointer. Why is this done? why notFrom what I understand a string is just a array of chars. If this is
just use argv[].
Another question I have lets say you have the following.
int main(){
char * word;
cout << "enter word: ";
cin >> ......
can I some how use malloc or calloc to store the response and return a
pointer to word?
Thanks
J