Possible Duplicate:
C String literals: Where do they go?
If I have the following code
char *str = "Tryout" ;
where is the string going to be stored? Stack? If stack, does the pointer point to a stack location then?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The string has a static storage class, (likely in read only data) and
stris a local variable with automatic storage. This is why it is better declared asconst char *.