Search code examples
cide

This specific C code snippet doesn't seem to build and run in the Code:Blocks IDE


Yes, I had googled the specific problem, which was a /n snippet of the code, but it gives me error messages.

Here's the code

{
    printf("Godsmack" \n);
    printf("I don't watch movies" \n);
    printf("My cat likes Adventure Time" \n);
    printf("11 meters per second" \n);
}

The error messages read: Line 10 (first line):

... error: stray ‘\’ in program
     printf("Godsmack" \n);
                       ^

And line 10:

... expected ")" before ‘n’

Line 11 (same messages)


Solution

  • Your \n needs to be part of your string:

    {
        printf("Godsmack \n");
        printf("I don't watch movies \n");
        printf("My cat likes Adventure Time \n");
        printf("11 meters per second \n");
    }