Hi,
This is one of the questions in my practical:
"3. Scanf with Pointers:
Create a file called user_input.c.Inside, write a function called readInts() that reads three ints and one char andexports them to the calling function.The function should obtain these values from the user. The user should be asked toenter the three ints, one after another, and then enter either “A” or “D”."
It then asks for these values to be passed by reference into another function which I created in part 2 of the practical.
This is what I have so far:
Code:
#include <stdlib.h>
#include <stdio.h>
void readInts();
}
int intOne
int intTwo
int intThree
char charOne
printf("Enter First Integer\n");
scanf("%d", &intOne);
printf("Enter Second Integer\n");
scanf("%d", &intTwo);
printf("Enter Third Integer\n");
scanf("%d", &intThree);
printf("Enter 'A' or 'D'\n");
scanf(" %c", &charOne);
}
I'm really unsure how to pass these values into another function.
Any help is much appreciated :)