I am pretty new to programming . And I am coming across this declaration a lot. Say for example:
char *x = "geeksquiz";
Does this mean that x holds the address of first element of the string,i.e, the character 'g' ?
If so then consider the following example:
char *str1 = "geeks";
char *str2 = "forgeeks";
printf("str1 is %s, str2 is %s", str1, str2);
Output is:
str1 is geeks, str2 is forgeeks
How come printf statement prints str1 is geeks and str2 is forgeeks , if they hold addresses respectively ? or is it the placeholder %s that's instructing the printf to print the string literals ?