I'm not entirely sure exactly what validation that you're looking for. If you're looking simply for validation that the character types you were looking for were entered, Wug's answer is close.
If you're looking for another function that does some validation, this could provide a starting point for you:
#include <stdio.h>
int get_input (int *integerINput, char *characterInput);
void valid_input (int inp);
main()
{
int integerInput;
char charInput[2];
// man scanf reports that scanf returns the # of items
// successfully mapped and assigned.
// gcc 4.1.2 treats it this way.
if (get_input (&integerInput) < 2)
{
printf ("Not enough characters entered.\n");
return;
}
valid_input (integerInput);
}
int get_input (int *integerInput, char *characterInput)
{
int inputCharsFound = 0;
printf ("Enter an integer: ");
inputCharsFound += scanf ("%d", inp);
printf ("Enter a character: ");
// The first scanf leaves the newline in the input buffer
// and it has to be accounted for here.
inputCharsFound += scanf ("\n%c", characterInput);
printf ("Number of characters found = %d\n", inputCharsFound);
return inputCharsFound;
}
void valid_input (int inp)
{
if (inp > 5)
printf ("You entered a value greater than 5\n");
else
printf ("You entered a value less than 5\n");
}
EDIT
HasanZ asked for more details on how to handle more than one variable in the comments below. I've updated the code to read in another input character.
I'll leave it to you to determine how to best accept the appropriate input and validate that input since you've asked in generic terms how to validate in a separate function.
I would also take a look here for more information on C programming.