This code print Only first letter i.e 'H'
#include <stdio.h>
int main(void)
{
char *s = "Hello";
printf("%c\n", *s);
}
But this return 'Hello'
#include <stdio.h>
int main(void)
{
char *s = "Hello";
printf("%s\n", s);
}
changing %c to %s will return an error in the first code
changing %s to %c will return an error in the second code
In my understating *s is dereferencing operator i.e what value we find when you go to that address and s is what store in s(address of 'H'). Please, someone explains this.