#include <stdio.h>
void main(void)
{
char* p ="sahil";
printf("%c,%c,%c,%c",*p,*(++p),*(p++),*p);
}
result:
h,h,s,h
it should be:
s,a,a,h
Could someone explain the result.
one more situation:
#include <stdio.h>
void main(void)
{
char p[] ="sahil"; <<<< Change in the declaration
printf("%c,%c,%c,%c",*p,*(++p),*(p++),*p); <<<<Line 7
}
Result-In function 'main':
Line 7: error: invalid lvalue in increment
Line 7: error: invalid lvalue in increment
Plz explain