I have the following code:
#include <stdio.h>
void changeValue(char str[]) {
str[2] = 'a';
}
int main()
{
char a[]="Hello world";
changeValue(a);
printf("%s", a);
}
And I am trying to understand how this is working. Why when passing the array named 'a' it is being passed by reference? So, the changes that I do inside changeValue are actually seen from the outside? Shouldn't be the function parameter defined as char *str, in order to be able to change it?