Pointer and strings

char *pointer=“abc”,what does this exactly do?How can we store a string directly inside pointer instead of initialising with its address

Hey @kani001 when you do char *pointer, you initialise a pointer of char data type that will store address of character data type. Now when you do char *pointer = “abc”
Here abc is a string and your char *pointer will be having address of string[0] that is “a”
So we are not storing entire string in char pointer but only the address of a from which we will get access to iterate over all string elements. If this solved your doubt. Mark it as resolved :slight_smile:

char *pointer = “abc” sets pointer to the address of the “abc” string (which may be stored in read-only memory and thus unchangeable)…what does this mean…explain in detail please

Please create separate post for new doubt