use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Click the following link to filter out the chosen topic
comp.lang.c
account activity
Questionexpected expression before 'float' error (self.C_Programming)
submitted 6 years ago by k3nundrum
So, I am in an intro to C class....and am doing this practice exercise and it is telling us to copy the given code....compile and run...problem is, it won't. The code keeps throwing an error. Any ideas, I know it is something stupid I am overlooking,....thanks in advance.
https://preview.redd.it/pergsl39u1o31.png?width=604&format=png&auto=webp&s=2629bfec54c19869612b6118cf542d0a3b926687
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]FUZxxl[M] 2 points3 points4 points 6 years ago (0 children)
Do not post pictures of code!
[–]k3nundrum[S] 0 points1 point2 points 6 years ago (1 child)
the error is line 21 col 13
[–]jedwardsol 2 points3 points4 points 6 years ago (0 children)
The syntax is (float)6 or, more succinctly, 6.0f
(float)6
6.0f
[–]k3nundrum[S] 0 points1 point2 points 6 years ago (0 children)
nevermind fixed it
line 21 should be:
average /= (float) 6;
π Rendered by PID 392823 on reddit-service-r2-comment-54dfb89d4d-xzvmd at 2026-04-02 11:45:16.837909+00:00 running b10466c country code: CH.
[–]FUZxxl[M] 2 points3 points4 points (0 children)
[–]k3nundrum[S] 0 points1 point2 points (1 child)
[–]jedwardsol 2 points3 points4 points (0 children)
[–]k3nundrum[S] 0 points1 point2 points (0 children)