Why is C so hard and frustrating to grasp?

Why is C so hard and frustrating to grasp?

Help!

Other urls found in this thread:

github.com/libretro/RetroArch/blob/master/tasks/task_patch.c#L526
twitter.com/SFWRedditGifs

What are you having trouble with?

dont worry user, just practise. You'll get there.

C is easy, stop being a brainlet.

Get a solid foundation in maths first + SICP then learning a language won't really be a problem.

>Racism isn't a problem, just stop being black.

Pointers
Thanks
:(
>Get a solid foundation in maths + SICP
I tried reading SICP, I had to quit out of boredom

>Why is C so hard and frustrating to grasp?
Just how is that even possible, C is bare metal it does not even handle strings.

> False equivalency explains everything!

>Differential calculus is easy, just stop having genetically dispositioned inferior intelligence

Because you need to stop thinking like a human in strings, characters, decimals, and floats and start thinking like a machine with memory addresses and bytes.

Now that is... better. Not good, just better.

pointers are numbers (almost always the native integer size) that just happen to correspond to another number in memory.
that number could be a char, an int, the first element of an array, or a struct, it doesn't matter, c's types will manage that for you.
pointer arithmetic is literally just one idea: adding an integer to a pointer gives you the pointer + the integer * the size of the type pointed to by the pointer.
i.e. for an int pointer on a platform with 4 byte ints, adding 1 to it will give you whatever it was + 4.
this only works with ints, subtracting two pointers will still give you the right value.

Don't just read shit.Use your imagination and do your own projects at your own pace.

>Pointers
Pointers only represent where a variable is stored in memory.
Their value is literally an address that says "this variable is stored here".

since we have so many C geniuses in this thread, anyone want to explain this shit to me?

github.com/libretro/RetroArch/blob/master/tasks/task_patch.c#L526

>declare variable `err` of type patch_error
>assign some blank function to it that takes a bunch of variables
>check its output on the next line

where the fuck is the actual function that is run on line 529? how can you run a blank function?

He's not assigning the function, you flaming mongoloid.

He is calling the function, ergo err is assigned the return value from that call.

look at the function header. it's being passed in.
congratulations - you unlocked pointers

>where the fuck is the actual function that is run on line 529? how can you run a blank function?
It's a function pointer.

Ikr, I still cant make an autorun or a program without the use of an IDE
Fucking C, and they say its good for beginners

>Posting sci meme list
>Doesn't even include discrete maths
While anyone who doesn't know calculus is a dumb pajeet, discrete mathematics is a lot more important.

nigga i had more trouble with shit like C# than i did C, it's easy

o I see it. they called it "func". It was blue and a really generic name so I thought that was a special C keyword.

Try the triple ref video from computerphile.

> Doesn't even know about function pointers

This is why brainlets should be prohibited from programming in any serious language. Keep to your pythons and your basics.

How the fuck can you not understand pointers. If you understand how array indices work you know how pointers work. Because a pointer is literally an index on your memory.

Only difference is pointer arithmetic.

>tfw too stupid for programming
>tfw too stupid for math

>I had trouble with thing which is thing plus other thing than I had with just the other thing
You dont say

>tfw too much of a brainlet to find a pdf version of "Logic: The Laws of Truth".
Does anyone have it? I can't seem to find it.

>Why is C so hard and frustrating to grasp?
It's not, it's just frustrating to use, since it is incomplete and half-assed.
And that aura of incomplete and half-assed infected the programmers using C and it shows in the tools, the ecosystem and the resulting software.

>too dumb for c
maybe go program with rust or sepples.

americans don't learn this at school

if you know how numbers work you know how pointers work. they are just numbers pointing at a memory address. it's the most simple concept ever yet people become drooling retards when they hear the word pointer

>rtfm

you're not too stupid for math. your school probably just does what all schools do: confusing you with superbly shitty math classes. ignore what you "learned" in school and do some of the meme courses on youtube. you will understand it in no time. math generally is pretty easy - mathtards just love inventing complicated sounding names for super easy concepts.

usually libgen.io has everything in multiple formats as well.

Use
The
CLI

It is good to understand how the machine works.

It is good to start, but not "good for beginners" in the sense of being easy, it is one of the hardest languages to learn.

But if you get to understand C, you actually understand programming, with other easier languages you usually just become a code monkey that does stuff but doesn't understand them.

Because you're white

If so why every OS has security holes?

A lot of people have trouble with pointers at first. Just move on and keep trying to write small programs that manipulate them. Pactice will cement anything you want to learn.

C# is C with diabetes and a health regimen. So no shit

because building complex systems with many interacting parts is hard for humans? I'm impressed that modern OS don't have more holes

>SICP
Why do people fall for this meme?

This, this to the highest degree, holy shit.

I thought I was a fucking idiot in Math, that my brain just wasn't "built" for it. I had a shitty math education in school and my fundamentals were never really cemented, so I nearly abandoned programming in college because of it.

I grew up a little bit and started applying myself. Looked up videos online from people who actually knew how to teach and all of a sudden, I'm not acing Math classes left and right.

After you get past a certain hill, the difficult just plateaus. You see that it isn't as big and scary as you thought.

>I'm now* acing math classes left and right

care to tell more about your trip? what stuff did you see and such?
I'm interested.

/thread

Because C is a very simple, very fast and horribly outdated programming language.
Using C for critical software is fucking moronic.

>it is one of the hardest languages to learn.
Why so, it's pretty simple.
People who say they don't understand C but know other languages in fact don't understand either. They only pretend to understand something but write code by copypasting examples and are clueless about what's actually going on. If you can't handle C, you better pull out or remain codemonkey forever.

>pointers are numbers
wrong! stopped reading right there

t.transgender rustfag shill

you can hate C even if you're not a rustitor

int a = 12;
printf("%llu\n", &a);
I wonder what happens

don't you have a neovagina to stretch?

undefined behavior happens, don't you know C at all?

lololol
this is legit the worst explanation of pointers I have ever hard

Pointers are basically the memory address of some data. One of the basic reasons why they're used is because functions are passed copies of the arguments, not the variables themselves, and thereby trying to edit them just changes the copy which is used in the function, not the actual variable. In order to change the actual variable you provide a pointer which points to the memory location. This is why scanf needs pointers, but not printf. Another usage is that sometimes the memory address is smaller than the data itself. In this case it can be used for performance reasons.

I'm not even sure how I'm supposed to follow this graph

So for example if you had a variable a and a function b, just passing a to b as an argument won't help.

int a = 0;
int b(a) {
a = 1;
}
b(a)
printf("%d", a); // This prints 0.

Instead you provide a pointer to memory location where the data is kept.


int a = 0;
int b(a) {
&a = 1;
}
b(a)
printf("%d", a); // This prints 1.

Another use case is if the data in a is larger than the memory address of a. In this case it'd often be faster to use a pointer pointing to a than a itself, because you're shuttling around less data.

well meme'd friend, only math you need to know is discrete math for most of programming

Higher-level languages do stuff like this for you automatically, but since C is a low-level systems programming language built for speed and being close to the hardware you're expected to do this stuff yourself. Another thing you're expected to do yourself is garbage collection, essentially deleting things from memory when no longer needed. Although high-er level languages do this automatically, C expects you to do it yourself. I'd suggest using Rust instead where the speediness and close-to-the-metal nature of C is not required.

>int a = 0;
>int b(a) {
>&a = 1;
>}
>b(a)
>printf("%d", a); // This prints 1.
should be
int a = 0;
int b(int* a) {
*a = 1;
}
b(&a)
printf("%d", a); // This prints 1.

disregarding the fact that nested functions aren't allowed.

I want a meme course where do I find

Because without memes /gee/ wouldn't exist

bump.

You don't understand pointers not because you're a fool, it's because you're approaching a black-box.

A lot of C guides try to create an abstraction, but really you should learn assembly and use a debugger to
learn about the memory segments and virtual memory of a program, learn what's actually fucking there,
then pointers will be a breeze, infact C will be too, since C gives you full access to the program's virtual
memory.

Understanding stack frames is key to knowing about recursion also, this is why knowing low-level is the best
to actually get "programming". If you're using Linux, use gdb, if not, get on Linux and learn C. C should be learned
under a unix or unix-like environment.

But seriously, learn assembly first, it's not that hard, don't just learn the instruction set only either this is wrong,
learn how it works, if you don't, you'll never be competent at C.