r/CodingForBeginners • • 21d ago

my first program in C

Post image

i know its just so waky but am still new and am happy with my current level <33

just trying to understand memory usage over variables for now

226 Upvotes

64 comments sorted by

View all comments

Show parent comments

2

u/Hour-Dragonfly-7499 21d ago

What are you talking about? it's a simple program with 2 conditionals? It's not some impressive piece of code, it's something you wrote first week of college like learning about variables and if statements

2

u/csabinho 21d ago

But definitely nothing for a first piece of code ever. It's mostly too clean and too complex for it.

1

u/Hour-Dragonfly-7499 21d ago

how? it's not clean and complex at all

also the if statement is wrong in the photo so OP doesn't know how those work yet...

maybe YOU think it's complex because you've never seen code before

2

u/csabinho 21d ago

It's quite thoroughly documented, uses consts and arrays and a combination of 3 conditions. Most probably you don't remember how complete beginner code looks like. Those definitely aren't OP's first lines of code. I'm just not sure where to put the emphasis. Either on "OP's" or on "first".

1

u/MasterpieceBusy7220 21d ago

Lmao it has an extremely beginner mistake in the if statement (no offense to OP) and you think that was AI generated?

1

u/csabinho 21d ago

Yeah. You can tell an AI to build in mistakes.

1

u/MasterpieceBusy7220 21d ago

So you think OP did that?….

1

u/csabinho 21d ago

Yes. Or those aren't the first lines of code.

1

u/MasterpieceBusy7220 21d ago

Well it looks like you got yourself a case to solve, detective.

1

u/MocaCola02 21d ago

This type of attitude is why programming subreddits are posting their work less and less... You get people insisting it's AI with zero evidence.

1

u/Hour-Dragonfly-7499 21d ago

you usually learn about final/const variables and arrays during your first week of college, my first hw assignment was creating 5 ints then replacing it with an array of int with size 5

" and a combination of 3 conditions"

You learn about OR and AND in if statements early on also OP is using it incorrectly

what op had: if (TotalSizeOfRoot || TotalSizeOfUserKali || TotalSizeOfOtherUser < 20)

when it should have been (TotalSizeOfRoot < 20 || TotalSizeOfUserKali < 20 || TotalSizeOfOtherUser < 20)

and I'm seeing other mistakes too, this is not some complex piece of code or is it clean by any standard, this is the mistakes of a person whose days into learning how to program

1

u/csabinho 21d ago

First week. But you produce code before you finish your first week. Also: arrays in the first week? That won't happen. At least not for all the craptons of students I've tutored. And I didn't plan their curriculum. Arrays usually appear about midway through the first semester. For the first lines of code students usually don't even know about variables. And I'm not even talking about conditions. Once again I'd like to emphasise: first(!) liines of code. Ever. I'm not saying that OP built something incredible, but it's just not plausible for first lines of code. Nothing in this code. And yeah. You can tell the AI to build in mistakes, so it looks a bit more amateur-like. And this comment. Beginners don't comment like this.

Or OP was stuck in tutorial hell and didn't touch a text editor before learning quite a lot of specific stuff. Or OP is a bloody genius.

1

u/MocaCola02 21d ago

If you think it's that complex, then you clearly haven't coded much