My program just doesn't work. I get this error.
population/ $ make test
test.c:6:9: error: missing terminating '"' character [-Werror,-Winvalid-pp-token]
printf(R"EOF(
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 errors generated.
#include <stdio.h>
#include <cs50.h>
int main(void)
{
printf(R"EOF(
_____ _ _ _ _ _ _ _____ _
/ ____| | | (_) | | | | | | | / ____| (_)
| (___ _ _| |__ _ __ ___ _| |_| |_ ___ __| | | |__ _ _ | | _ _ _ __ ___ __
\___ \| | | | '_ \| '_ ` _ \| | __| __/ _ \/ _` | | '_ \| | | | | | | | | | '__| \ \/ /
____) | |_| | |_) | | | | | | | |_| || __/ (_| | | |_) | |_| | | |___| |_| | | | |> <
|_____/ \__,_|_.__/|_| |_| |_|_|\__|\__\___|\__,_| |_.__/ \__, | \_____\__, |_| |_/_/\_\
__/ | __/ |
|___/ |___/
)EOF");
}
This construction
R"EOF(
_____ _ _ _ _ _ _ _____ _
/ ____| | | (_) | | | | | | | / ____| (_)
| (___ _ _| |__ _ __ ___ _| |_| |_ ___ __| | | |__ _ _ | | _ _ _ __ ___ __
\___ \| | | | '_ \| '_ ` _ \| | __| __/ _ \/ _` | | '_ \| | | | | | | | | | '__| \ \/ /
____) | |_| | |_) | | | | | | | |_| || __/ (_| | | |_) | |_| | | |___| |_| | | | |> <
|_____/ \__,_|_.__/|_| |_| |_|_|\__|\__\___|\__,_| |_.__/ \__, | \_____\__, |_| |_/_/\_\
__/ | __/ |
|___/ |___/
)EOF"
represents a raw string literal the notion of which is defined in C++.
In C such a construction is absent.
Instead you need to write adjacent string literals with new line characters '\n'
something like the following
" _____ _ _ _ _ _ _ _____ _\n"
"/ ____| | | (_) | | | | | | | / ____| (_)\n"
"| (___ _ _| |__ _ __ ___ _| |_| |_ ___ __| | | |__ _ _ | | _ _ _ __ ___ __\n"
"\___ \| | | | '_ \| '_ ` _ \| | __| __/ _ \/ _` | | '_ \| | | | | | | | | | '__| \ \/ /\n"
"____) | |_| | |_) | | | | | | | |_| || __/ (_| | | |_) | |_| | | |___| |_| | | | |> <\n"
"|_____/ \\__,_|_.__/|_| |_| |_|_|\\__|\\__\\___|\\__,_| |_.__/ \\__, | \\_____\\__, |_| |_/_/\\_\\\n"
and so on.
They will be concatenated by the compiler as one string literal.
Pay attention to that in C++ you may insert a character like \
in a raw string literal and it will be outputted as is but in C you need to use escaped sequence in a string literal like \\
to output the symbol '\'
.
Otherwise compile your program as a C++ program.:)