pass by value / passy by reference
I'm experimenting with pass by value/reference and im having trouble maybe someone can help.
ill just post a simplified example of the problem i am having. i know it has something to do with pointers but everything i try doesent work.
Function call
Code:
readname (fin, a, emp);
emp has no value when brought into function
function
Code:
void readname(FILE* fin, struct emp a[1024], int num_emp) {
fscanf(fin, "%d", &num_emp);
printf("%d", num_emp);
}
num_emp = 2 when it prints in the function
then in main i print emp right after this function runs to check its value... ant it's 0 again.
do i need an ampersand somewhere?
thanks for the help.