-1


Write a C program to reverse a string with out using any string functions and with out using any temp variable ?
Asked in/Preparing for : tcs
Reputation : 161


1 Respond



#include <stdio.h>
#include <string.h>
int main()
{

char *str;
int i,len;

printf("\nEnter String : ");
gets(str);
len=strlen(str)-1;
for(i=0;i<strlen(str)/2;i++)
{

str[i]+=str[len];
str[len]=str[i]-str[len];
str[i]=str[i]-str[len--];

}
printf("\nReverse String is : %s",str);
return 0;

}
 

To get all study materials on C Programming for interview preparations please CLICK HERE

Admin Team



Written
Exam Questions
BLOG Posts
For study materials
Job Walk-In
Updates across India
Interview round
Questions
Interview or procedure
Experiences
Files
For study materials
Please LIKE our page to Get regular JOB WALK-IN UPDATES across India and STUDY MATERIALS on facebook news feed.