I want to pass a reference to a string variable (char[]) to a funtion and have the function change the original value of that string - but I CANNOT get this to work. I am going mad - any help?
See following little prog which I think SHOULD work but doesn't!! It changes the string variable to some random char??
#include <stdio.h>
void changeString(char *str[]);
void main()
{
char string[]="NO";
printf("\nString: %s\n\n", string);
changeString(&string);
printf("Changed String: %s\n\n", string);
}
void changeString(char *str[])
{
*str="YES";
printf("Change to: %s\n\n", *str);
}