I wrote this function to reverse a string in C, but when switching characters in the string the program crashes. I have no idea what\'s causing it, so any help would be apprecia
read this for more information What is the difference between char s[] and char *s?
Another link https://stackoverflow.com/questions/22057622/whats-the-difference-structurally-between-char-and-char-string#22057685
this should fix it.
main()
{
char array[] = "Example";
reverse(array);
}
when you do reverse("Example")
this is the same as
char *string = "Example";
reverse(string) //wont work
The links should clarify your doubts from here.