あなたが探している検証が正確にはわかりません。探していた文字タイプが入力されていることを確認するだけの場合は、Wug の答えが近いです。
何らかの検証を行う別の関数を探している場合、これが出発点になる可能性があります。
#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 は、以下のコメントで複数の変数を処理する方法の詳細を求めました。別の入力文字を読み取るようにコードを更新しました。
一般的な用語で別の関数で検証する方法を尋ねたので、適切な入力を受け入れてその入力を検証する最善の方法を決定するのはあなたに任せます。
Cプログラミングの詳細については、こちらもご覧ください。