I have 2 questions...(I am learning C and this might be silly questions. Apologies)
As per How to declare strings in C and in most of the books, they always say declaring a string even though you are allocating memory by saying
char p2[] = "String";
My question is, Is there anyway to declare a string?
As per https://stackoverflow.com/a/1704433/1814023, in an example like this,
char s[]="hello";
are placed in read only area and then copied to array. Is it valid in C to print the address of the string like this?
printf("%p\n", &"Hello There"); // I tried, it prints some address
and by doing this
printf("%p\n", &"Hello There");
printf("%p\n", &"Hello There");
it is printing the same address. what is feel is, it should print different address. Is compiler doing some optimization here?