(Attachment title: C language test questions
The file format in the compressed package: executable file
Attached source: Internet
Operation mode: Windows mode
Is it verified by yourself: yes
Attachment nature: free
Detailed description: If you think it works, you can download it yourself
3. Programming questions
Please write a function intfun(int
s,intt,int
k), which is used to find the subscript of the smallest element of the array in the array and store it in the storage unit pointed to by k.
For example, enter the following integers:
234345753134436458100321135760
The output is 6,100.
Note: Part of the source program is given below.
Do not change any content in the main function main and other functions, and only fill in some sentences written in the curly braces of the function fun.
Exam procedure:
#includelt;conio.hgt;
#includelt;stdio.hgt;
intfun(int
s,intt,int
k)
{
}
main()
{
inta={234,345,753,134,436,458,100,321,135,760},k;
clrscr();
fun(a,10,k);
printf(
n,k,a);
}
Answers and Analysis:
intfun(int
s,intt,int
k)
{
inti;
k=0;/
The number pointed to by k is the subscript value of the array
/
for(i=0;ilt;t;i )
if(sgt;s)
k=i;/
Find the smallest element of the array and assign the subscript of the element to the number pointed to by k
/
returns;/
returns the smallest element of the array
/
}
[Analysis] The pointer variable k is used directly in this question, but attention should be paid to the pointer operation on k when using it.
The value of k is a subscript value in the array, that is,
k=0.
test questions.doc
.....too many files .....)