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 1 month ago
The AI made him do it.
sirbadger about 1 month ago
She should tell him that if he rewrites that in assembly language, she’ll accept it.
soundcomm about 1 month ago
Well, he already wrote it once in the code, so perhaps “count <=” could be 499!
pwil3058 about 1 month ago
If he’s so smart why didn’t he write the code in Rust?
Sanspareil about 1 month ago
Nice “C” code, brings back memories!
Benhamean about 1 month ago
There’s no way Jason wouldn’t start his count variable at 0
cpiller Premium Member about 1 month ago
I’m loving all these geek critiques!!!
txmystic about 1 month ago
would have been cooler if he used some formatting parameters…
Steverino Premium Member about 1 month ago
C Señor.
Alverant about 1 month 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 1 month 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 1 month ago
She’s got no sense of humor.
IndyW about 1 month ago
I LUV this kid’s style. I would have wrote it in PASCAL or Tiny BASIC.
Brilliant_Birdie about 1 month ago
Impressive though!
KEA about 1 month ago
Is that some variation of “C”? It’s one language I haven’t learned. (my programming days got Way back)
mindjob about 1 month ago
It’s not the accuracy, it’s the length of the assignment needed
dflak about 1 month ago
This is why I like this strip: I like geek.
M.K.Staffeld about 1 month ago
That look of ’I’ve lost count of how many times he’s done this’
Brian Premium Member about 1 month 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 1 month 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 1 month ago
The teacher gave him a C for the assignment…
gmu328 about 1 month ago
those were the days when we first learned how coding worked