Very simple code

Write a function suffix that takes a char* representing a null-terminated character array (a C string), and returns the string obtained by starting at the second letter. Just need to fill in "???." Need help

#include <iostream>
using namespace std;

char* suffix(char* text) {

return ??? ;

}

int main() {
char* word = (char*) "lion";
cout << word << endl;
cout << suffix(word) << endl;
cout << suffix(suffix(word)) << endl;
cout << suffix(suffix(suffix(word))) << endl;
}
1
2
3
4
5
char* suffix(char* text) {

return &text[1];

}
Topic archived. No new replies allowed.