Write a function which takes a character array as input and
reverses it in place.
Answer Posted / gumnam
void reverse(char *a)
{
char tmp;
int len = strlen(a) - 1;
for (int i = 0; i < len/2; i++)
{
tmp = a[i];
a[i] = a[len - i];
a[len - i] = tmp;
}
}
| Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
Is it legal in c++ to overload operator++ so that it decrements a value in your class?
What is static in c++?
Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?
explain the reference variable in c++?
Write a short code using c++ to print out all odd number from 1 to 100 using a for loop
What are protected members in c++?
What is string in c++ programming?
What is diamond problem in c++?
Must accepts "Maestro Cards" Tax for bike should be less than 15 Total number of lanes is more than 10 Must provides monthly pass Write a method: boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes); String[] cardsAccepted A String array of names of card types accepted for payment of toll tax, it can be null if the toll does not accept any card String[] tollTax A String array of toll tax chart (say “Train : 300â€Â,â€ÂBullCart : 10â€Â) boolean hasMonthlyPass This parameter defines whether there is any monthly pass available or not int numberOfLanes This parameter defines the number of lanes for each side
What is the best way to declare and define global variables?
Explain the problem with overriding functions
What is object file? How can you access object file?
Do the names of parameters have to agree in the prototype, definition, and call to the function?
What are the new features that iso/ansi c++ has added to original c++ specifications?
Explain the purpose of the keyword volatile.