How to reverse a String without using C functions ?

Answer Posted / shruti

char * rev_string (char * str)
{
char temp;
int i , j;
for (i = 0 ; str[i]!= NULL ; i++);

for(j = 0 ; j < i ; j++ , i--)
{
temp = str[j];
str[j] = str[i];
str[i] = temp;
}

return str;
}

Is This Answer Correct ?    59 Yes 40 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

4047


why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

2497


write a program for area of circumference of shapes

2225


What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

2627


how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

3342






What is data _null_? ,Explain with code when u need to use it in data step programming ?

3011


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

2252


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2564


#include int main(void) { int a=4, b=2; a=b<>2 ; printf("%d",a); return 0; }

1293


Cluster head selection in Wireless Sensor Network using C programming language.

3375


Write a routine to implement the polymarker function

4581


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

4071


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

729


Sir... please give some important coding questions asked by product companies..

2019


Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.

2886