#include <stdio.h>
int main() {
printf("Text Segment!\n");
/* *char pointer address gets stored in stack but string literal value gets stored
text segment which is read only, when you try to modify text segment ,it gives segmentation
fault (core dump) , to change the string value you need allocate memory i.e char str[] = "Ganesh"
ptr[2] = 'T' gives GaTesh output
*/
char str[] = "Ganesh";
str[2]='T';
printf("str %s\n",str);
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: