Ask your own question, for FREE!
Computer Science 28 Online
OpenStudy (anonymous):

HELP ME ON THIS ERROR PLEASE IN C #include #include void main(){ question(); char question(){ char x; printf("Do you want to proceed (Y/N)? "); scanf("%c",&x); check(x); } void check(char y) { if(Y=='Y' || y=='y' || N=='N' || n== || 'n') exit(0); else question(); } }

OpenStudy (anonymous):

Whats the error? Based on that code I would move your other functions OUTSIDE of main, like: char question() { blah blah blah } void check() { blah blah blah } int main() { blah blah blah } Also, use this: if(y == 'Y' || y == 'y' || y == 'N' || y == 'N') Instead of what you have. You are checking the 'y' variable for its contents.

OpenStudy (anonymous):

Your program should be as follow : #include <stdio.h> #include <conio.h> char question(){ char x; printf("Do you want to proceed (Y/N)? "); scanf("%c",&x); check(x); } void check(char y) { if(y=='Y' || y=='y' || y=='N' || y== 'n') /* That doesn't make sense because you exit the program if the user choose yes or no, but it's ok this is your code. */ exit(0); else question(); } void main(){ question(); return 0; } Good luck.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!