Here's the prompt immediately before that, writing the code to a file. (Which I'm now realizing wasn't quite formatted right, but it worked anyway.)
Interestingly, it didn't like so I had to manually add the declaration for printf.
Here's the prompt immediately before that, writing the code to a file. (Which I'm now realizing wasn't quite formatted right, but it worked anyway.)
Interestingly, it didn't like so I had to manually add the declaration for printf.
The original code is c++, so
g++
was the right call. The first couple errors are c++ like, as&
isn't part of the type system in C. But it's valid c++. This is the correct error in C, for some new-ish version of gcc:main.c: In function ‘main’: main.c:7:8: error: expected identifier or ‘(’ before ‘&’ token int& i = k;^ main.c:9:5: error: ‘i’ undeclared (first use in this function) if (i == 17)
This one is really interesting as it's the most basic bitch variable declaration, but it might get confused because
int k
probably isn't in the training lexicon.ref.c: In function ‘int main()’: ref.c:7:10: error: ISO C++ prohibits declaration of ‘k’ with no type [-fpermissive] int k = 17;