Here is the answer to one question the interviewer gave me:
#include <iostream.h>
using namespace std;
// toLower
char *toLower(char *ptr);
int main() {
char *test = new char[251];
cout << "Enter a string to lower : ";
cin.getline(test, 250);
toLower(test);
cout << "The result is : " << test << endl;
}
char *toLower(char *ptr) {
while (*ptr != '\0') {
if (*ptr > 'A' && *ptr < 'Z') {
*ptr -= 'A' - 'a';
}
*ptr++;
}
return ptr;
}