This is the problem I've been assigned and have yet to figure out where I'm going wrong.

Write a C function named liquid() that is to accept an integer number and the addresses of the variables gallons, quarts, pints, and cups. The passed integer represents the total number of cups, and the function is to determine the number of gallons, quarts, pints, and cups in the passed value. Using the passed addresses, the function should directly alter the respective variables in the calling function. Use the relationships of 2 cups to a pint, 4 cups to a quart, and 16 cups to a gallon.

This is what I have so far but I can't get the correct output, please let me know where i went wrong.

Code:

#include <stdio.h>

void liquid(int ,int*,int*,int*,int*);

int main()

{

int num1=0, cups, pints, quarts, gallons;

printf("Enter the number of cups:");

scanf("%2d",&num1);

liquid(num1, &cups, &pints, &quarts, &gallons);

return 0;

}

void liquid(int x, int *gallons, int *quarts, int *pints, int *cups)

{

if (x>=16)

*gallons=x/16;

printf("The number of gallons is %d\n",&gallons);

if (x>=8)

*quarts=x/8;

printf("The number of quarts is %d\n",&quarts);

if (x>=4)

pints=x/4;

printf("The number of pints is %d\n",&pints);

if (x<4)

*cups=x;

printf("The number of cups is %d\n",&cups);

return;

}