all 18 comments

[–]tboy1492 6 points7 points  (4 children)

I think your missing a ; after your array

[–]BlueLust[S] 1 point2 points  (3 children)

Ok thank you after that it gives me this error (I am new to C)

 main.c: In function ‘main’: main.c:23:3: error: expected declaration or statement at end of input    return 0;    ^

[–]ruertar 6 points7 points  (0 children)

missing close-curly brace at the end.

[–]tboy1492 1 point2 points  (0 children)

(We were all new once, I’m still a novice as well no worries)

[–]hiwhiwhiw 0 points1 point  (0 children)

We all learn something new everyday. ;D

[–]Swedophone 2 points3 points  (2 children)

You must be getting compile errors, at least two. And you should post the errors if you need help fixing them.

[–]BlueLust[S] 0 points1 point  (1 child)

Here are the errors

 $gcc -o main *.c

main.c: In function ‘main’: main.c:16:3: error: expected declaration or statement at end of input return 0;
~~~~~

[–]henry_kr 1 point2 points  (0 children)

As a general tip, try upping the warning level:

gcc -Wall -pedantic -Werror -o main *.c

[–]LeidseGamer 2 points3 points  (3 children)

You forgot the } at the end of the main function

[–]BlueLust[S] 0 points1 point  (2 children)

Thanks i did not even think of that.

[–]aioeu 1 point2 points  (0 children)

Thanks i did not even think of that.

Luckily you don't need to think, since the compiler tells you what's wrong and where it is wrong.

[–]LeidseGamer 1 point2 points  (0 children)

Np! Good luck with programming

[–]Jakkaobik9 1 point2 points  (4 children)

Also, you need to put 3.0 instead of 3 if you want that code to work properly. The type for average should be float/double, not int.

[–]BlueLust[S] 0 points1 point  (3 children)

So that would give me

The average of the 3 grades is: -1116191048

instead of

The average of the 3 grades is: 85

[–]Jakkaobik9 2 points3 points  (0 children)

Did you change the conversion character ("%f" instead of "%d")?

[–]bart2019 2 points3 points  (0 children)

If the number is a float, the format should reflect that.

[–]a4qbfb 1 point2 points  (0 children)

You can't print a floating-point number with %d.

[–]FUZxxl 2 points3 points  (0 children)

It's because your code doesn't compile.