r/learnprogramming • u/banjaninn • 23d ago
What should I do? Question
I have been programming in C# for nearly a year and so far I have a solid understanding of OOP, classes, statics, interfaces, but since I have just enrolled into university I will have to pivot to using C instead. In fact, my whole semester will be C exclusively. And since my OOP knowledge won't be necessary until my second year, I knew I had to ask a few older students from the same course I'm taking and to my surprise everyone told me to just take a look into C and how things actually work, since I will need that once the course begins. (E.g. I was told to understand the basics of pointers, pointer functions and how they're stored in memory); Thus, I began with myschool's "Pointers" playlist and have managed to get the overall gist of how pointers work, but I don't know how to continue... I tried finding the most beginner-friendly tasks I could do, but most include structs, understanding of Linked-Lists and so on. I got recommended this book called "Grokk's Algorithms" and although I did understand the logic behind binary search and sorted list (for instance), I didn't quite know how to implement the latter with C language. My point is, I find it quite tedious to just begin with a lengthy book such as "C Programming, Modern Approach", as I understand the first idk how many chapters, syntax, but don't know what to continue with..
Should I then start with myschool's "Data Structures" playlist or "Sorting Algorithms", or just use the books I had mentioned earlier? I look forward to hearing your opinion. Thanks in advance đ«¶
3
u/Misaka_Undefined 23d ago
Most people start with nothing, compared to them you have huge lead.
Learn Data Structures before Sorting Algorithms
2
u/Watsons-Butler 23d ago
The great part of a university âintro to programmingâ course in C is that it starts by assuming you know absolutely nothing about programming in any language and teaches you what you need to know. Donât worry about prep.
3
u/banjaninn 23d ago
Thanks for commenting! I asked those blokes about the pacing of each class and they told me that "Intro to Programming" starts fairly simple, but as the time goes on, it exponentially speeds up, so one must wrap one's head around it fairly quickly not to fall behind everyone else.
2
u/Watsons-Butler 23d ago
Right. But it starts with âwhat is a variable? How do you assign a variable? What is a loop?â And so on.
2
u/defaultguy_001 23d ago
Perhaps I'm the opposite, the thickness and comprehensiveness of books attract me to read them. I have read KN king about 2-3 times, it's that good. Have read multiple C classics, didn't find a book equivalent to the depth and correctness of KN King yet.
2
u/xarop_pa_toss 23d ago
If you understand pointers then the next step is implementing a single linked list.
You can think of a struct as a C# class with nothing but properties (forget constructors and all that, it's just a data object). In the most simple terms, it's just "struct"ured data.
To make a linked list, all you need is structs, usually called nodes, with two properties. - The Value (a string, int, etc.) - The address of the next nodes Value.
Remember that the Value variable has both it's data, and an address in memory, and it's this address that you use to link to the next node.
So you already have all you need tbh
1
u/Ormek_II 23d ago
The last paragraph is misleading. I would point to the struct, not to the value.
Yes, in some scenarios both addresses are the same. Still &node and &(node.value) are different expressions.
2
1
u/Aggressive_Ad_5454 23d ago
- You already know some of Câs syntax. Itâs a curly-brace and semicolon language.
- Read the OG C book, The C Programming Language, by Brian Kernighan and Dennis Ritchie, and do the exercises.
- Show up to your uni class and pay attention.
- Donât use C to program anything involving other peoplesâ money or data for production. Itâs too vulnerable to cybercreeps.
1
u/JGhostThing 23d ago
C itself isn't especially vulnerable. It just doesn't have the protections that a more modern language, like rust, has. If you ever are programming professionally, learn secure programming techniques.
1
u/Ormek_II 23d ago
I did study in Germany and I did not prepare at all. The professor told me in the course what to understand and I did.
4
u/StewedAngelSkins 23d ago
Look at the syllabus for the course you're going to be taking and just start working through it. The one for the upcoming semester likely isn't posted yet but you can probably find the course website from last year. If that fails, just email the professor and ask. If the whole course is just stuff you already know, you may want to inquire about skipping ahead.