#include
main()
{
char * ptr;
ptr = \"hello\";
printf(\"%p %s\" ,\"hello\",ptr );
getchar();
}
Hi, I am trying to underst
#include
main()
{
char * ptr;
ptr = "hello";
//instead of above tow lines you can write char *ptr = "hello"
printf("%p %s" ,"hello",ptr );
getchar();
}
Here you have assigned string literal "hello"
to ptr
it means string literal is stored in read only memory so you can't modify it. If you declare char ptr[] = "hello";
, then you can modify the array.