#include <stdio.h>
#include <string.h>
int main(void) {
char pA[10] = "seoul";
pA[5] = NULL;
printf("\n");
char *pB = pA;
//*pB = "busan";
printf("%s\n", pA);
printf("%s\n", pB);
}
Add NULL and spin it Uncomment the PB and compile it If you annotate and compile it, you can check how the memory address changes.
*pB = "busan"; // compilation error
There must have been a compilation error on the above line.
pB = (char*)"busan";
Fix it like this and try it.
© 2024 OneMinuteCode. All rights reserved.