0
I have the code below that has a function to define the salary = 4000, but it returns me the following error:
[Error] request for Member 'salario' in Something not a Structure or Union
The error occurs in the line I try to define the salary. I am using parameter passage by reference, because passing parameter by value does not change the salary of Joao, because the changes only occur within the function, not reflected in his salary.
#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);
}
Thank you very much William
– Giovani
I hit my eye and already saw, but Guilherme was faster ;p
– user2692