[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.
Interview Questions and Answers :: Cisco

1. Reverse a string in C using as little additional memory as possible.

Answer:

// C program using recursion to reverse a string.

# include
void reverseString(char *str)
{
if (*str)
{
reverseString(str+1);
printf("%c", *str);
}
}

int main()
{
char a[] = "India is a great country";
reverseString(a);
return 0;
}

Post Your Answer Here:      Public      Private

Rate This: +1 -0
Report     

Post Your Reply Here:     

Report Error

Report Error

Please Login First Click Here