I am coding a function to validate a number inserted by the user (between 1 and 3) and it doesn't matter what number I put the program crashes.
Here's my code:
int validate(int low, int high) {
int selection;
do {
scanf("%d", selection);
if (selection < low || selection > high)
printf("Invalid Input, try again: ");
} while (selection > low || selection < high);
return selection;
}
Anyone any idea, please?