I'm trying to understand why the value of each array location of a string cannot be changed when i input the string pointer to a function
i tried to use instead of [] to *
#include <stdio.h>
#include <string.h>
void func(char * p)
{
int i;
char letter;
for(i = 0 ; i < strlen(p) / 2; i++)
{
letter = p[strlen(p)-i-1];
p[strlen(p)-1-i] = p[i];
p[i] = letter;
}
puts(p);
int main()
{
char * p = "dudu";
func(p);
return 0;
}
an example of what im tring to do can be john and than output of the function nhoj like changing sides of the characters of the string
changing values of the beggening with the end of the string