simple c++ program for "abcde123ba" convert "ab321edcba"
with out using string

Answer Posted / prasenjit roy

#include "stdio.h"

int main(int argc, char* argv[])
{
char sBuffer[]="abcde123ba";
char sBuff[100];
char *pStr = sBuffer;
int i;
puts(sBuffer);

while(*pStr != '\0')
++pStr;
for ( i = 0; pStr != sBuffer; i++,pStr--)
sBuff[i] = pStr[-1];
sBuff[i] = '\0';

puts(sBuff);
return 0;
}

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is a reference variable in C++?

659


Can we define function inside main in c++?

551


When should we use container classes instead of arrays?

580


In c++, what is the difference between method overloading and method overriding?

594


How delete [] is different from delete?

591






What is the identity function in c++? How is it useful?

549


What are friend classes?

609


What is the auto keyword good for in c++?

618


What is the main function c++?

593


What is c++ runtime?

651


What is the difference between set and map in c++?

605


How would you call C functions from C++ and vice versa?

634


If horse and bird inherit virtual public from animal, do their constructors initialize the animal constructor? If pegasus inherits from both horse and bird, how does it initialize animal’s constructor?

634


What is c++ flowchart?

674


What is stoi in c++?

695