0

Question on a C++ Problem

Here's a link to the (Simple) Problem: https://drive.google.com/file/d/1otWlT4v8rnrGJGEL7X_n6vz_0J0dIc59/view?usp=sharing How does char *str = "hello"; work? How can we make a pointer str of character type to "hello"? Isn't "hello" not even stored in the memory? And we're not even using the '&' operator, so please explain. What exactly is char *str referring to? I've seen the notation char * somewhere, but don't know what it is. Please help. How does const int* p1; work? When we define some constant variable (including pointers), don't we have to initialize it at the moment of creation? So that statement is saying p1 is an integer pointer with a fixed address, right? But it doesn't even define that integer or give that address! This is why I am confused. Please help me with the above. Thank you so much!

16th Jul 2020, 5:57 PM
Aarav Dodhia
Aarav Dodhia - avatar
1 Antwort
16th Jul 2020, 7:43 PM
rodwynnejones
rodwynnejones - avatar