- Joined
- Apr 17, 2023
- Messages
- 2
- Reaction score
- 0
I'm learning to code in C with the help of a friend, but a code that I'm trying to write doesn't work
int number (int x) {
int n = 2 * x + 4;
return n;
}
int main () {
int x = 10;
printf("The answer is %d\n", n);
}
What I'm trying to do is for the formula to get solved with the input from int main, but it just tells me that x inst defined. I tried swapping around some of the intigers, but it doesn't work at all.
int number (int x) {
int n = 2 * x + 4;
return n;
}
int main () {
int x = 10;
printf("The answer is %d\n", n);
}
What I'm trying to do is for the formula to get solved with the input from int main, but it just tells me that x inst defined. I tried swapping around some of the intigers, but it doesn't work at all.