请解释输出

Joh*_*ohn 0 c

#include<stdio.h>
#include<conio.h>

int t=8;

int dok(int);
int doky(int);

int main()
{
    int clrscr();
    int x,y;
    int s=2;
    s*=3;
    x=dok(s);
    y=doky(s);
    printf("%d%d%d",s,y,x);
    getch();
    return 0;
}

int dok(int a)
{
    a+=-5;
    t-=4;
    return(a+t);
}

int doky(int a)
{
    a=1;
    t+=a;
    return(a+t);
}
Run Code Online (Sandbox Code Playgroud)

回答上述代码:665

我明白为什么s=6,x=1+4=5(a=6-5=1,t=8-4=4)...请告诉我如何y正值6,我以为y会是1+4=5(a=1,t=4)

谢谢,请帮帮我.

Mah*_*esh 5

告诉我你是怎么来的6 ...

调用dok函数修改t为4.

int doky(int a)
{
    a=1;
    t+=a;    // Previously t is 4 because of t-=4 in earlier function call
             // t = 4+1 = 5
    return(a+t);   // 1+5 = 6 retured
}
Run Code Online (Sandbox Code Playgroud)