I'm learning C frens

i'm learning C frens

Attached: file.png (666x402, 56.25K)

Other urls found in this thread:

kernel.org/doc/html/v4.10/process/coding-style.html
twitter.com/AnonBabble

>GNU style

Attached: 78.png (300x100, 14.21K)

>imlearningcfrens

kernel.org/doc/html/v4.10/process/coding-style.html
Read this first before posting code.

Retard. You just wasted over 100 bytes of memory for garbage. Either use cosnt char* or use char str[] (without numbers in square brackets)

Try learning how not to be racist next.

Attached: rattlesnake.jpg (750x923, 89.6K)

>char str[100] = "Fuck"
LMAO cniles really feel smart writing these shit code

I'm too stupid for malloc.

Attached: 1653672829828.jpg (377x402, 81.86K)

>100 of length
>only use 4
>10
>use 7
go back to pyshit

this board should ban anyone who hasn't completed cs101 im tired of seeing this shit

Attached: 1652624134895.png (463x473, 229.53K)

i allocate over 100 kb whenever i declare a string literal. why? simple, i dont care about you or your feelings. i WILL use the entire system memory. if its not being used it IS being wasted. and my program WILL use it. you cant stop me, and thousands of people use my (closed source btw) programs.

cniles... who said they can't entertain

>i dont care about you or your feelings
>you cant stop me

Attached: arnold lifting log.jpg (1469x1471, 447.47K)

What's wrong with initializing your array?

>All these people mad about wasting less than a kilobyte in a toy example from someone actively learning C
you guys really are all autistic huh

Go back to coding python. C is made for efficient code, not for tranny tier code that you are pulling from your ass

It's the cniles who get autistic about memory usage, not normal people.

The WHOLE point of C is memory and processing efficiency. If you aren't going to write programs like that then why C? Just use python/java/ruby instead

based
cnile pseuds seething

Problem is not initializing your array. Problem is polluting the stack with unused garbage.

Why are your braces so lonely? Such waste...

It's larger than the data inside it because he's going to add more to it later.

Just use const char*.

> he's going to add more to it later.
??
He only added 7 bytes out of 96.

He strcats into str, with your advice he would corrupt the memory lmao.
Using a tiny bit more stack space wont even cause the program to run slower.

It's about learning good coding and good code design from the start. The people who do a CS degree and then complain they can't get a job are always the ones who were too lazy to adhere to public standards and who copypasted without regard for understanding anything. The seething and coping of someone who wasted 4 years for nothing is immeasurable.

Attached: 1654753297803.jpg (938x1515, 99.52K)

how do i learn to adhere to public standards?

oh no, a whole 96 bytes of memory
how will the computer recover from hello world

>Using a tiny bit more stack space wont even cause the program to run slower
No, but it is not efficient in memory terms to do so. The first thing he should learn is: if you are programming in C memory matters. Performance matters. Lowest possible memory usage and highest speed are your goal. Only use more memory if it increases the speed

But then he can't add more data.

Overallocating is better than underallocating.

He can, just not from the code. If he wanted to add more he would have said so

I see that you ran out of argument.
>oh no, a whole 96 bytes of memory
The more cniles write code the more memory cniles waste.

>Overallocating is better than underallocating.
Where is the OOM handling path?

C is not only about memory and processing efficiency. It's also about control. With C, you have the ability to control every aspect of the program. You can optimize your code to run faster and use less memory. But you can also write code that is more reliable and easier to maintain. It's a very powerful language that can be used for a wide variety of applications. Sure, it's not as easy to use as some other languages, but that's because it's designed to be powerful and efficient. If you're not interested in those things, then you should probably use a different language.

But he did if you read the code.

that isn't even GNU style but if it were it'd be based

Attached: gahnoo style.png (575x733, 90.06K)

>Overallocating is better than underallocating.
Wrong.

Never use strcat, always use strncat to avoid invalid reads/writes. This applies for all other string functions too (strncpy, strncmp, etc.). Not doing stuff like this is why rustfags etc. are always dicking themselves off with "muh safe language"

By looking up the public standards of the technology you want to use and using it that way?

Attached: 1654780113063.jpg (828x1025, 782.03K)