Possible Duplicate:
What is the difference between char s[] and char *s in C?
Difference between char a[]=“string”; char *p=“string”;
Firstly, i would like to ask where can i learn all the basics of char* and char[].
Most of the time i find myself struggling with how to compare and how to declare.
Example 1 :
char *test = "hello world";
This will produce the following warning at compilation :
warning: deprecated conversion from string constant to ‘char*’
Example 2 :
vector<char*> test2;
test2.push_back("hello world");
This will produce an error of copying a string.
So the solution i come up with is :
(is this correct?)
vector<char*> test3;
char *str1 = "hello world"
test3.push_back(str1);
Thanks in advance! :)
============================================
Two good reads provided by people here :