I was wondering why the following code leads to a SIGSEGV?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void splitt(char string[255]){
string[1] = 'a';
}
int main (void){
splitt("cut");
}
I thought that if I passed a pointer to a function as a parameter, I could change the content of the pointer in this function and this would also have an effect in the calling function. That's why I'm confused why this doesn't work.
Thank you in advance for any help!