Is it bad practice to directly pass strings into functions?
Will it cause memory errors?
func(char *x) {
//do stuff
}
func("String");
Or is it safer to do this?
char *s = "string";
func(s);
Is it bad practice to directly pass strings into functions?
Will it cause memory errors?
func(char *x) {
//do stuff
}
func("String");
Or is it safer to do this?
char *s = "string";
func(s);