Hello!
So, I am completely stuck on my last HW problem. This is the problem it gives to me:
Change the printNumber method :
- Change the code INSIDE the method to have it RETURN the value.
- In the main(), create an int value favNum
- In main(), call the method and have the value returned assigned to the variable favNum
- In the main(), display favNum
I'm sure I would be fine on the rest if I could only figure out what exactly he's talking about for the first one? How do I return from a void? And I am guessing by 'the value', he means return 23? I don't know why I'm so confused, I did just fine on all the other 5 problems.
This is what I have.
Code:
# include <stdio.h>
/*all prototypes here*/
void printColor();
void printGreek();
void printFood();
void printSport();
void printNumber();
void printSubject();
void printPet();
void printCar();
void printTeam();
int main()
{
/* make all calls from here!!! */
int favNum;
return 0;
}
/* all methods here */
void printColor() { printf("Blue\n"); }
void printGreek() { printf("Pi\n"); }
void printFood() { printf("Pizza\n"); }
void printSport() { printf("Hockey\n"); }
void printNumber() { printf("23\n"); }
void printSubject() { printf("English\n"); }
void printPet() { printf("Cat\n"); }
void printCar() { printf("REG 123 Blazer\n"); }
void printTeam() { printf("Browns\n"); }
Thank you for any help!