#include<stdio.h>
#include
int main()
{
voidantitone(char *a);
int i;
charch[10];
printf("enter the string\n");
for(i =0;i<10;i++)
{
scanf("%c",&ch[i]);
}
antitone(ch);
for(i =0;i<10;i++)
{
printf("%c",ch[i]);
}
return0;
}
void antitone(char *a)
{
int i =0,j=1,flag = 0,temp;
while(i<10/2&&j<10-1)
{
if(flag||(a[10-j-i]!=' '))
{
temp = a[10-1-i];
a[10-1-i] = a[i];
a[i] = temp;
flag =1;
i++;
}
else
{
continue;
j++;
}
}
}
there're some error remaining in the codes.when i input the stringending with space ,the system can't distinguish what i enter ,andgoes into a endless loop. Butif i use the sentence of "gets" ,i must face another quetionthat i will
overstep the boundary of thearray when someone inout chars more than the length of arraydefined.
#include
int main()
{
}
void antitone(char *a)
{
}
there're some error remaining in the codes.when i input the stringending with space ,the system can't distinguish what i enter ,andgoes into a endless loop. Butif i use the sentence of "gets" ,i must face another quetionthat