char *a = “Hi how are you??”
a[0] = ‘h’;
This will output Segmentation fault
Because, such an intialization will create const memory and it can’t be modified.
While
char a[] = “Hi how are you??”
a[0] = ‘h’
will give the desired output.
When curiosity outbursts …!!!
char *a = “Hi how are you??”
a[0] = ‘h’;
This will output Segmentation fault
Because, such an intialization will create const memory and it can’t be modified.
While
char a[] = “Hi how are you??”
a[0] = ‘h’
will give the desired output.