欢迎来到考试题库网 考试题库官网

问答题

请编一个函数fun(oh lr*str),该函数的功能是把字符串中的内容逆置。
例如,字符串中原有的字符串为asdf9,则调用该函数后,串中的内容为9fdsa。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填人所编写的若干语句。
试题程序:
#include<string.h>
#include<conio.h>
#include<stdio.h>
#define N 100
void fun(char * str)
{


}
void main()
{
char a[N];
FILE*out:
printf("Enter a string:");
gets(a);
printf("The origir al string is:");
puts(a);
fun(a):
printf("The string after modified:");
puts(a);
strcpy(a,"Welcome!");
fun(a);
out=fopen("outfile.dat","w");
fprintf(out,"%s".a);
fclose(out);
}


    【参考答案】

    char ch;
    int i,m,n;
    i=0:
    m=n=strlen(str)-1; //求字...

    (↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)

    点击查看答案&解析

    相关考题