I have the code below that has a function to set the salary = 4000, but it returns the following error:
[Error] request for member 'salary' in something not a structure or union
The error occurs on the line that I try to set the salary. I'm using parameter passing by reference, since parameter passing by value does not change the salary of Joao , because the changes only occur within the function, not being reflected in the salary of it.
#include <stdio.h>
#include <stdlib.h>
typedef struct{
int idade;
int salario;
}PESSOA;
void setSalario(PESSOA *p){
*p.salario = 4000;
}
int main(int argc, char *argv[]) {
PESSOA joao;
setSalario(&joao);
printf("Salario do joao: %d",joao.salario);
}