This is one of the very famous interview question asked in almost all technical interviews. Let me repeat the question once again here.
Question: Write a program to reverse a string without using temporary string.
int main( )
char str[ ] = “Subhash Embedded Classes”;
printf( “%s”, str );
void reverse( char s[ ] )
int c, i, j;
for( i = 0, j = strlen(s) – 1; i < j; i++, j– )
c = s[i];
s[i] = s[j];
s[j] = c;
sessalC deddebmE hsahbuS
To improve yourself in C programming, I would suggest you to read “The C Programming Language” by Dennis.M.Ritchie.
Subhash.K.U, Principal Mentor, Subhash Embedded Classes,Bangalore.