私はCが初めてで、これまでのところ非常に異なっています。それにもかかわらず、scanf と switch ステートメントを使用してメイン関数から関数を呼び出そうとしていますが、呼び出す関数が機能しているとは思いません。
int main(void)
{
int Example_number = 0;
bool Continue = true;
char ch;
while(Continue)
{
printf("Which example would you like to run?\n");
scanf("%d",&Example_number);
switch(Example_number)
{
default: printf("No such program exists.\n");
break;
case 1: void Various_test();
break;
}
printf("Would you like to test another?(Y/N)\n");
scanf("\n%c",&ch);
if(ch == 'Y' || ch == 'y')
{
NULL;
}
else
{
Continue = false;
}
}
}
void Various_test(void)
{
int k = 2;
printf("\n%d",k);
}
1が入力の場合、プログラムが2を出力することを望んでいますが、whileループは繰り返されます。
この質問をご検討いただきありがとうございます。