#include <stdio.h>
int main() {
char *p = "hi";//constant pointer//read only *p takes whole string as value
//stores whole string addresss
char *q = "ello";//constant pointer//read only
char s[] = "ello";//its same as a normal variable
if(p==q){//this compares address of both p & q
printf("hii");
printf("%s",p);
}
if(*p==*q){//this compares the 1st value of both p(h) & q(e)
printf("hi10");
printf("%s",p);
}
else{
printf("no");
printf("%s",s);
}
//then output will be equal
}
/*
As for this declaration
char *n = "hii";
then the string literal "hii" has the type char[4] and internally is represented
like { 'h', 'i', 'i', '\0' }. Array designators used in expressions with rare
exceptions are converted to pointers to their first elements.
So the above declaration is equivalent to the following
char *n = &"hii"[0];
*/
To embed this program on your website, copy the following code and paste it into your website's HTML: