Write a function which takes a character array as input and
reverses it in place.
Answer Posted / arun
#include<iostream>
using namespace std;
void reverse(char *a)
{
char *tmp = new char[strlen(a)];
memset(tmp,0,strlen(tmp));
int a1 = strlen(a);
a1 =a1-1;
for (int i = a1;i>=0; i--)
{
tmp[a1-i] = a[i];
}
cout<<tmp<<" "<<strlen(tmp)<<endl;
}
void main()
{
char *name = "Xerox";
reverse(name);
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Can I learn c++ without c?
What is a literal in c++?
Explain what are mutator methods in c++?
What is data structure in c++?
What is the use of cmath in c++?
How the keyword struct is different from the keyword class in c++?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create
What does obj stand for?
Explain the benefits of proper inheritance.
What does iomanip mean in c++?
What problems might the following macro bring to the application?
Can we distribute function templates and class templates in object libraries?
what is software cycle? What is a mission critical system ? What is the important aspect of a real-time system ? Explain the difference between microkernel and macro kernel. Give an example of microkernel.Why paging is used ? Which is the best page replacement algo and Why ? What is software life cycle ? How much time is spent usually in each phases and why Which one do U want to work if selected in Honeywell ? Which are the different types of testing ? What is a distributed system ? Some questions about CSP. Which languages do U know ? What are the differences between Pascal and C. questions from Compiler construction and Lisp. Which are the different computer architecture? What is the requirement in MIMD ? What is the difference between RISC and CISC processors ? Difference between loosely coupled and tightly coupled systems ? What is an open system?
What is code reusability in c++?
What is fflush c++?