# Analysis of the most popular level 2 C language ty

2022-10-15
• Detail

Analysis of typical problems in Level 2 C language

has the following procedures

void (inta[], inti, intj)

{intt;

{t=a[i]; a[i]=a[j]; a[j]=t;

f (a, i+1, J-1);

}

{p>inti, aa={1,2,3,4,5 according to incomplete statistics}

f(aa,0,4);

for(i=0;i i++)printf("%d,",aa[i]); printf("n");

}

after execution, the output result is

a) 5,4,3,2,1, b) 5,2,3,4,1, c) 1,2,3,4,5, d) 1,5,4,3,2,

resolution: F (AA, 0,4) call is address two-way transfer I=0, j=4, exchange the values of aa= and aa so that aa={5,4,3,2,1}; Then recursively call f (a, i+1, J-1), that is, f (a, 1,3), and exchange the values of aa and aa= so that aa={5,4,3,2,1}; Then recursively call f (a, i+1, J-1), that is, f (a, 2,2), because i=j=2, exit the function call, and successively output the array elements of aa as "5,4,3,2,1,"

(47) there are the following programs

structstu

{charname;

intnum;

intscore;

}

main()

{structSTUs={{"YangSan",20041,703},{"LiSiGuo",20042,580},

{"WangYin",20043,680},{"SunDan",20044,550},

{"Penghua",20045,537}},*p,*t;

inti,j;

for (i=0; I i++) p[i]= s[i is mainly composed of machine base, column, fixed beam, working oil cylinder, upper beam and working piston]

test method: the tensile speed is 100mm/min

for (i=0; I i++)

for (j=i+1; J j++)

if (p[i]- score p[j]- score)

{t=p[i]; p[i]=p[j]; p[j]=t;}

printf("%d%dn",s.Score,p- Score);

the output result after implementation is

A) 550550b) 680680c) 580550d) 580680