Does below code segments mean the same thing or each one has a different meaning
char *data = "blah";
char* data = "blah";
char * data = "blah";
Does below code segments mean the same thing or each one has a different meaning
char *data = "blah";
char* data = "blah";
char * data = "blah";
The three are same. The only differences are,
The string literals "blah"
could be stored in the same memory location or different locations. From the C11 standard,
6.4.5 String literals
[...]
- It is unspecified whether these arrays are distinct provided their elements have the appropriate values. If the program attempts to modify such an array, the behavior is undefined.
All of them are same
char *data = "blah";
char* data = "blah";
char * data = "blah";
char*data = "blah";