C
Programming and Technical
Programming
Output
#include
int main()
{
char str[20]="hello";
char * const p=str;
*p='M';
printf("%sn",str);
return 0;
}
Read Solution (Total 3)
-
- Mello
P stores the address of 'h' and the address is constant,But we can change the character present in that address which is done in the Step 3.
So 'h' is replaced by 'M' which results in string "Mello".
- 9 years agoHelpfull: Yes(9) No(2)
- Mellon
P stores the address of 'h' and the address is constant,But we can change the character present in that address which is done in the Step 3.
So 'h' is replaced by 'M' and also add in printf("%sn",str); that means 'n' which results in string "Mellon".
- 9 years agoHelpfull: Yes(7) No(0)
- Since p is declared as const ,we cannot increment or decrement it.So p will be pointing to the base address.When we try to replace the first charac with M then output becomes
"Mello" - 9 years agoHelpfull: Yes(1) No(0)
C Other Question