You appear to be implementing recursion in your post. But some of the lines in your code are not needed, and hinder the potential efficiency of a recursive algorithm.
The essentials of a recursive algorithm can be captured in 2 statements:
1) Each recursive call should be on a smaller instance of the same
problem,
that is, a smaller subproblem.
2) The recursive calls must eventually reach a base case, which is solved
without further recursion.
(from here)
Following is an adaptation of your original EnterNumber()
function reduced to having only those essentials of a recursive algorithm listed above.
- reads and tests input character (smaller instance...)
- leaves when test fails criteria (base case...)
It can be expanded as needed to include the other features you desire in your original post (such as more user input, or notice to user that input was not a digit)
void EnterNumber(char a);
int main(void)
{
char c;
int num;
printf("Enter your number:");
scanf(" %c", &c);
// ^ notice space preceeding format char,
// comsumes newline from previous read and allows next input
num = isdigit(c);
EnterNumber(c);
printf("\nHit any key to exit\n");
getchar();
return 0;
}
/// Simple demo of recursion:
/// caches input as long as it is a number
/// outputs cache and exits if alpha char
void EnterNumber(char a)
{
if(isdigit(a) != 0)
{
printf("Enter your number:");
scanf(" %c", &a);
// ^ notice space preceeding format char,
// comsumes newline from previous read and allows next input
EnterNumber(a);
}
printf("%c\n", a);
}
Regarding space in format string of scanf() function:
Whitespace character: the function will read and ignore any whitespace
characters encountered before the next non-whitespace character
(whitespace characters include spaces, newline and tab characters --
see isspace). A single whitespace in the format string validates any
quantity of whitespace characters extracted from the stream (including
none). (from here)