I am back with a brand new puzzle for C/C++ addicts. Following the feedback received on the 1st puzzle, this time I will try to make the requirements crystal clear and to provide a perfectly valid code.
Here is the problem. Given the following code:
#include <iostream>
char message[6]="hello";
void print_hello_message() {
std::cout << message;
}
int main() {
char* q = &message[0];
// insert your code here
}
You are required to insert two more lines where the comment specifies in order to make the program print "hello" and nothing more, with the following restrictions:
the first line will NOT call any function, including cout
the second line will contain AT MOST 5 letters (and as many other symbols as you want)
the first line may contain new variable declarations but may not initialize them
the symbols # and / will not be used at all.
no logical operators will be used
The shortest code wins!
cout
count as a function call ? \$\endgroup\$cout
isn't a function call.<<
is a function call, when applied tocout
. \$\endgroup\$