Hello I am new here hopefully I won't have broken any rules by the end of this post but I need help with my project. The goal is to include these 3 pointer functions into my code(replacing whatever needs to be replaced) the functions are void halve(int* number) void readAge (int* age), and void writeAge(int age). I don't expect anyone to do it for me but if anyone could give an simple similar example that would be amazing. Here is my code(hopefully I get the tag to work). If my indentation is off it's the copy paste but it looks good in the compiler.
Code:
int readAge(void);
void writeAge(int age);
int main(void) {
int age;
age = readAge();
writeAge(age);
printf("Double that time and... \n", age);
writeAge( 2 * age);
printf("Wow that's old! \n", age);
printf("Now if I cut your age in half... \n", age);
writeAge(age / 2);
printf("Haha you're almost a kid again! \n", age);
return EXIT_SUCCESS;
}
int readAge(void )
{
int age;
printf("How old are you?");
scanf("%d", &age);
return age;
}
void writeAge(int age)
{
printf("You are %d!\n\n", age);
}