私はこのコードを書いて、デフォルトのGCCコンパイラを使ってコードブロックでコンパイルしようとしました。
オプション1を指定すると、この出力が「hello world6356744」になります。 何が起こっているのか説明してください。このcプログラムのコンパイルと実行後に不明なエラーが発生しました
#include<stdio.h>
#include<stdlib.h>
int fun1(int x,int y)
{
printf("hello world");
return x+y;
}
int fun2()
{
return 0;
}
int main()
{
printf("type 1 for * or type 2 for #");
int a;
scanf("%d", &a);
int ca1;
switch(a)
{
case 1:
ca1=fun1(2,3);
printf("%d", &ca1);
break;
case 2:
fun2();
break;
default:
printf("invalid input");
}
return 0;
}
https://i.stack.imgur.com/A5PhT.png
あなたは何をすると思いますか?その出力は私が期待するものです –