Code:
/*
Terrance Lynch
November 2, 2002
Pointers to functions test
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void test(int *int_pointer, int *t, int *z);
void times(int *int_pointer, int *t, int *z);
void RequestTwoIntegers(int *int_pointer, int *t, int *z);
int main()
{
int i = 50, *p = &i;
int x;
int y;
int *t = &x;
int *z = &y;
printf("i before the call to test = %i\n", i);
RequestTwoIntegers(p, t, z);
times(p, t, z);
test(p, t, z);
}
void test(int *int_pointer, int *t, int *z)
{
printf("i after the call to test = %i\n", *int_pointer);
}
void times(int *int_pointer, int *t, int *z)
{
*int_pointer = *t * *z;
}
void RequestTwoIntegers(int *int_pointer, int *t, int *z)
{
// request two integers from the user
printf("Please enter two integers: \n");
scanf("%i", &t);
scanf("%i", &z);
}
I'm having trouble getting t and z from the user, the bottom function RequestTwoIntegers.
How do I set it up to accept user input, should I use scanf???