It’s pretty well-formed code, but there are some things that would get a ding on a peer review.
1. The main thing is that unintialized “count” variable. That’s bad in C, and most compilers would issue a warning for that. As this is ISO standard C, you can just declare and init the variable in the control:
for (int count = 1; count <= 500; ++count)
2. In C, for() loops should start at 0 unless there are very good reasons to do something else. None are apparent in the code as written.
3. I’d also suggest using puts() rather than printf() for efficiency reasons. Now, if he wanted to number the output statements, then printf() would be appropriate as would starting the variable at 1:
printf(“%d. I will not throw paper airplanes in class.\n”, count);
Imagine about 2 months ago
The AI made him do it.
sirbadger about 2 months ago
She should tell him that if he rewrites that in assembly language, she’ll accept it.
soundcomm about 2 months ago
Well, he already wrote it once in the code, so perhaps “count <=” could be 499!
pwil3058 about 2 months ago
If he’s so smart why didn’t he write the code in Rust?
Sanspareil about 2 months ago
Nice “C” code, brings back memories!
Benhamean about 2 months ago
There’s no way Jason wouldn’t start his count variable at 0
cpiller Premium Member about 2 months ago
I’m loving all these geek critiques!!!
txmystic about 2 months ago
would have been cooler if he used some formatting parameters…
Steverino Premium Member about 2 months ago
C Señor.
Alverant about 2 months ago
To work off @sirbadger comment, he should do it in assembly, C#, python, ruby on rails, PHP, and (for history’s sake) ASP and ColdFusion.
John Jorgensen about 2 months ago
It’s clever enough that I’d accept it. Also, why is she giving out the old Bart Simpson punishment in, when did this first run, 2003?
Strawberry King about 2 months ago
She’s got no sense of humor.
IndyW about 2 months ago
I LUV this kid’s style. I would have wrote it in PASCAL or Tiny BASIC.
Brilliant_Birdie about 2 months ago
Impressive though!
KEA about 2 months ago
Is that some variation of “C”? It’s one language I haven’t learned. (my programming days got Way back)
mindjob about 2 months ago
It’s not the accuracy, it’s the length of the assignment needed
dflak about 2 months ago
This is why I like this strip: I like geek.
M.K.Staffeld about 2 months ago
That look of ’I’ve lost count of how many times he’s done this’
Brian Premium Member about 2 months ago
It’s pretty well-formed code, but there are some things that would get a ding on a peer review.
1. The main thing is that unintialized “count” variable. That’s bad in C, and most compilers would issue a warning for that. As this is ISO standard C, you can just declare and init the variable in the control:
for (int count = 1; count <= 500; ++count)
2. In C, for() loops should start at 0 unless there are very good reasons to do something else. None are apparent in the code as written.
3. I’d also suggest using puts() rather than printf() for efficiency reasons. Now, if he wanted to number the output statements, then printf() would be appropriate as would starting the variable at 1:
printf(“%d. I will not throw paper airplanes in class.\n”, count);
mirwin49 Premium Member about 2 months ago
A classmate of mine did this in BASIC in the late 70’s. It wasn’t for paper planes but was close enough. And just as successful.
Ricky Bennett about 2 months ago
The teacher gave him a C for the assignment…
gmu328 about 2 months ago
those were the days when we first learned how coding worked