Find the below program,
Code:
#include <stdio.h>
int main(int argc, char** argv)
{
char** ppch = "Hello World";
printf( "%s\n", *argv );
printf( "%s\n", *ppch ); // Segmentation fault
return 0;
}
why this is giving Segmentation fault while printing *ppcch? and why not in *argv? as both are pointer to pointer to char they should behave in same way.
but if I try to print the value value of ppch using
Code:
printf( "%s\n", ppch )
It is working fine but if I try this same thing with
Code:
printf( "%s\n", *argv );
It will print some junk values.
can any one give me the logical reason why this is happening?
--
Regards
Kunal