Hello,

I'm trying to wirte a program but I'm having trouble with call by address. When I use the * in the function prototype and in the function itself and an & in the function call in main, I don't get an error, but the value of 0 is not passed from main to the function AddData. Can anyone tell me how to make this work and where I have made my mistake?

Thanks,
Vireyda

Code:
#include<stdio.h> //include standard input output functions

//definitions section
//structure for travel expense account
struct TravelCosts
	{
	char employee_name[20];
	int emp_num;
	float distance_traveled;
	float mileage_rate;
	float meals;
	float total_expenses;
	};
void AddData(struct TravelCosts expenses[], int *num);
void PrintTravel(struct TravelCosts expenses[], int num);
void ChangeCosts(struct TravelCosts expenses[], int num);
void FindSpenders(struct TravelCosts expenses[], int num);

void main()
{
	//declarations section
	char response;
	static struct TravelCosts travel[20];
	int num_records = 0;

	do
	{
	printf("Please select an action:\n\n");
	printf("Add employee expenses\t\t- A or a\n"
	       "Print expense database\t\t- P or p\n"
	       "Change expense data\t\t- C or c\n"
	       "Find over spending employees\t- F or f\n"
	       "Quit Program\t\t\t- Q or q\n");
	fflush(stdin); 
	scanf("%c", &response);

	//switch to case based on response value
	switch(response)
	{case 'A':case 'a': 
		AddData(travel, &num_records);
		break;
	case 'P': case 'p':
		PrintTravel(travel, num_records);
		break;
	case 'C': case 'c':
		ChangeCosts(travel, num_records);
		break;
	case 'F': case 'f':
		FindSpenders(travel, num_records);
		break;
	case 'Q': case 'q':
		break;
	default:
		printf("\nThat selection is invaild.  Please try again.\n");
	}//end switch
	}while(response!='Q'&&response!='q');//end do
}//end main

void AddData(struct TravelCosts expenses[], int *num)
	{
	printf("%d", num\n);
	}