Passing parameter by pointer
#include <stdio.h>
void prompt(char *msg, int *num);
int main(void)
{
int i;
prompt("Enter a num: ", &i);
printf("Your number is: %d", i);
return 0;
}
void prompt(char *msg, int *num)
{
printf(msg);
scanf("%d", num);
}
Related examples in the same category