C语言编程问题;目的是将所给字符串的奇数下标上的小写字母转换成大写字母输出
#include<stdio.h>intmain(void){char*fun(char*p);char*z;charc[100]="asddgxQEZVBNR";z=f...
# include <stdio.h>
int main (void)
{
char *fun (char *p) ;
char *z ;
char c[100]="asddgxQEZVBNR";
z=fun (&c);
printf ("%s",*z);
}
char *fun (char *p)
{
char *q=p ;
int i ;
for (i=0;*q!='\0';i++)
{
if(i%2!=0&&*q>='a'&&*q<='z')
*q=*q-32 ;
}
return (q);
} 展开
int main (void)
{
char *fun (char *p) ;
char *z ;
char c[100]="asddgxQEZVBNR";
z=fun (&c);
printf ("%s",*z);
}
char *fun (char *p)
{
char *q=p ;
int i ;
for (i=0;*q!='\0';i++)
{
if(i%2!=0&&*q>='a'&&*q<='z')
*q=*q-32 ;
}
return (q);
} 展开
1个回答
展开全部
好几处写错了,我都改了,你参考一下:
# include <stdio.h>
int main (void)
{
char *fun (char *p) ;
char *z ;
char c[100]="asddgxQEZVBNR";
z=fun (c);
printf ("%s\n",z);
}
char *fun (char *p)
{
char *q=p ;
int i ;
for (i=0;*q!='\0';i++,q++)
{
if(i%2!=0&&*q>='a'&&*q<='z')
*q=*q-32 ;
}
return (p);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询