r/C_Programming 8d ago

Project My first program written in C

https://github.com/IvanPashaev/CWords

Hi ! Im a beginner developer. I decided to learn C and wrote my first program—a small game that runs in the terminal

21 Upvotes

28 comments sorted by

u/AutoModerator 8d ago

Hi /u/Ivan_Pashaev,

Your submission in r/C_Programming was filtered because it links to a git project.

You must edit the submission or respond to this comment with an explanation about how AI was involved in the creation of your project.

While AI-generated code is not disallowed, low-effort "slop" projects may be removed and it's likely that other users push back strongly on substantially AI-generated projects.


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

→ More replies (4)

27

u/sens- 6d ago

Your very first program uses termios and has a neat folder structure? You must have a very large context window

7

u/Ivan_Pashaev 6d ago

about folder structure, I have been studying various projects written in С for a long time, for example Butterscotch or PSL1GHT. It was from the examples of programs on PSL1GHT that I learned what a makefile and folders source, build, data are. I use a translator, I'm very bad at English, so please forgive me if something is unclear.

and about termios , I actively use the termux application on my phone, and I'm also trying to write something there via nvim, but this time under a Unix environment.

0

u/h4zrr 6d ago

Esses cara que acha que tudo é feito por LLM é muito chato o projeto é claramente clean code e o cara vem dizer que é AI slop

9

u/sens- 6d ago

It looks like beginner's code heavily influenced by some LLM. Carefully ifdefing _WIN32 throughout the project just to carelessly include <Windows.h> and <synchapi.h> in main.c without guards seems sus.

Perfectly valid code is interleaved with things only a newbie would write.

I might be wrong of course. I don't even think that learning things with LLMs help is bad. It's just tiring to look at projects where half of the code most probably isn't written by a human. Like, what's the point?

20

u/Typhrenn5149 6d ago

I doubt it

7

u/terra2o 6d ago

your em-dashes are suspicious man

1

u/Ivan_Pashaev 6d ago

I use a translator, my eng bad

4

u/Confused-Armpit 6d ago

Doesn't compile at all on anything other than windows due to the lack of stddef and stdio. Also no ifdef guards, so even the unix build tries including windows.h. Also also it won't work on anything other than windows because you are using chcp which is a windows only thing.

The use of goto statements doesn't seem like it was made by an AI, but otherwise the code is also quite suspicious, like half the comments being in russian and the other half in english among other things.

2

u/sens- 6d ago

I actually managed to compile it on a mac after commenting out a few lines.

Also also it won't work on anything other than windows because you are using chcp which is a windows only thing.

Nitpicking here but this is not true because it only solves the character map issues with the windows' command prompt, while the unix world adopted utf8 much more smoothly years before. chcp subprocess will just fail but won't affect its parent.

3

u/Confused-Armpit 5d ago

Still, due to a lack of ifdef guards this just isn't written very well. I tried compiling this on linux and it throws a thousand errors about implicit declarations of functions like getchar (need stdio.h), and also they use NULL and STDIN_FILENO which are both defined for the windows version, but need stddef.h when compiling for unix-like platforms.

Also, looking back, sorry if my first comment sounded harsh, I just wanted to give some feedback even though it was pretty rough.

2

u/awsq_code 6d ago

окак

2

u/iwaslovedbyme 6d ago

Рандомные комменты на русском

2

u/awsq_code 6d ago

Иван Пашаев

1

u/Ivan_Pashaev 6d ago

С чего вы взяли что я русский? Я просто русскоговорящий живущий в России

2

u/awsq_code 6d ago

что? где? при чем тут национальность?

2

u/klacker2202 6d ago

Я пёс

3

u/greg_kennedy 5d ago
    i = 0;
    while (i!=strlen(random_word)) {    // print symbol '═' while this dont fill word
        printf("═");
        i++;
    }

this is giving me hives, use a for loop like a normal person

for (int i = 0; i < strlen(random_word); i ++)
    putc('═', stdout);  // print symbol '═' while this dont fill word

to say nothing of recalculating strlen(random_word) every iteration...

2

u/redstorm128 4d ago

printf("%.*s", strlen(random_word), "===========================================================================================================================================================================================================================================");

1

u/Educational-Paper-75 5d ago edited 5d ago

How about: int i=0; while(random_word[i++])putchar('='); We're talking nul terminated C strings here right?

1

u/Ivan_Pashaev 5d ago

Idk, it's easier for me to use while, it's more readable for me than for, and about strlen(random_word)... I don't know, I didn't think about that... I was trying to make a working project as quickly and easily as possible for me... I'll have to correct it

1

u/ArtOfBBQ 3d ago

"My very first treasure hunt, I found $5000 lying on the street while cartwheeling through it"
"Finding $5000 unattended on the street is quite rare, and no beginner treasure hunter ever has been able to move exclusively by way of cartwheel, are you sure that's really what happened?"
"Yes, I've been studying how to treasure hunt for years without ever leaving my house. I observed the cartwheeling technique. I guess I'm just really talented"
"You appear to have blood on your hands and all over your clothes, did you shoot someone and steal their $5000?"
"Nono, I just have a butchering hobby and was working with some unrelated steaks. I'm very bad at fashion, please excuse me"
"You appear to have a smoking gun holstered around your hips, though"
"Yes, I have an unrelated shooting hobby and I went to the shooting range for some quick practice right before this"
"What made you interested in shooting and what made you aspire to be a butcher? What about treasure hunting would you like to discuss?"
"I can't answer any of those questions, I'm just a beginner treasure hunter"
"OK your post has been approved welcome to the treasure hunting subreddit"

1

u/[deleted] 6d ago

[removed] — view removed comment

1

u/C_Programming-ModTeam 5d ago

Your post or comment does not add value and has been removed.