60 507
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #56995 in C for rajashree g.s

Question #56995
write a c program to reverse a character array using pointers
Expert's answer
/* Question#56995, Programming, C */

#include <stdio.h>


void revers( char *str )
{
int n=0; // char counter;
int i=0;
while ( *str!= '\0') // set pointer to the end of the string
{
str++; //poinetr
n++;
}
str--;
for(i=n; i>0; i--) // reverse print of the string
{
printf("%c",*str);
str--;
}
}

int main()
{
char str[64]; //string buffer
printf("Enter string: ");
scanf("%s", str);
revers(str);
printf("\n");
system("PAUSE"); /*sys delay*/
return 0;
}



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions