填空题

请补充函数fun(),该函数的功能是:把一个整数转换成字符串,并倒序保存在字符数组str中。例如:当n=13572468时,str=-“86427531”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#include <conio.h>
#define N 80
char str[N];
void fun(long int n)

int i=0;
while( 【1】 )

str[i]= 【2】
n/=10;
i++;

【3】

main()

long int n=13572468;
clrscr();
printf("*** the origial data ***\n");
printf("n=%ld",n);
fun(n);
printf("\n%s",str);

【参考答案】

【1】n>0 【2】n%10+’0’ 【3】str[i]=’0’