How to reverse a string (using library function)?

Reversing a string is one of the first programs we write when we learn about loops. Anyway you don’t have to write the usual loop again to reverse a string. You can use _tcsrev ( _strrev ) function to reverse a character buffer. See the sample below

int _tmain(int argc, _TCHAR* argv[])
{
	TCHAR buff[] = _T( "Hello World!");
	_tcsrev( buff );
	_tcprintf( buff );
	return 0;
}

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

blog comments powered by Disqus