answersLogoWhite

0

char * RevString( char * str )

{

char * dup = strdup( str );

size_t len = strlen( str );

int x = 0;

int y = len;

while( x

str[ x++ ] = dup[ --y ];

free( dup );

return( str );

}

Note that you don't actually need this function since the standard built-in strrev() function reverses strings more efficiently than this.

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
BeauBeau
You're doing better than you think!
Chat with Beau
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach

Add your answer:

Earn +20 pts
Q: How do you program reverse letters using arrays in C plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp