+ 1
How to learn memory management
I am learning C but cannot think of how to actually implement memory management in real life situations. If I finish the Sololearn C course and then study Data Stuctures and Algorithms, will Data stuctures and Algorithms help me to better understand how to apply the knowledge about things like pointers and memory management that I learned in the C course? Any feedback would be greatly appreciated, thank you
10 Antworten
+ 4
My first language(s) were BASIC and TurboPascal on a Commodore C16 and Intel 8086 😅 I added C rather late...
I cannot recommend C# as a language paving a way towards C. It is fundamentally a different concept and following a different paradigm. It largely depends on where you are headed. You don't need C to learn C#, and neither the other way around.
Learning C will teach you a lot about the inner workings of a PC. C is still the lingua franca on UNIX systems. But if you want to go for development for a Windows environment, C is practically not used, except for perhaps very special niche programs, experiments, and perhaps driver libraries. But I am not really an expert in that area.
+ 3
Yes, I think so. Data structures will certainly require you to implement a lot of dynamic resource allocation and management.
I am not sure if it is of any help if you go in largely unprepared. That is to say, I cannot estimate what skills are already required before you start implementing data structures in C. Perhaps someone else can shed some light on it from personal experience :)
+ 3
You're welcome :). Incidentally, I have a code here implementing a kind of dynamically sized string. You may have a look at it if you like...
https://code.sololearn.com/c1WDri42R5LO
+ 2
Thank you
+ 2
Thank you so much. Also, if i may ask you, I really wanted to learn C being that it is a foundational/fundamental language but i feel like maybe i should start with an easier language like C# for instance and then after i have mastered C# i can move to C. Do you think that is a good idea? What was the first language that you learned? Any feedback would greatly appreciated, thank you
+ 1
I don't think SoloLearn is enough to actually understand memory.
one of the most important skills in programming is debugging and it is not easy to teach in Sololearn with practice.
you can get a better understanding of memory, by writing a simple program and load it into a debugger, then you can inspect the memory and how it's used by your program.
(example of debuggers: GDB, WinDbg, Radare2....)
most of IDEs come with a debugger to step through the code and examine memory(stack, heap) , cpu registers...
.
in short try to learn how to use a debugger. there are many, depending on what operating system you are using.
you can even go deeper to assembly to really understand how it works.
+ 1
When you're using C, you're actually doing memory management of your program using pointers.
C is a language very close to Assembly Language (actually, you can call Assembly language procedures in C), it originally was made to replace the ASM code of the UNIX OS.
If you will be doing Kernel Development (here you will do a lot of memory management), you will use memory management for the whole System when you need to allocate memory for a process for example.
If you're doing algorithms and data structures, you will use stack memory management and heap memory management (using malloc) for optimizing your programs (like passing for reference using pointers)
You will apply a lot of Real-life C when you're working with OS Development or Embbeded System Development, or maybe desktop application Development (even Malware Development and Reverse Engineering). And for all of this (except desktop app dev) you will need to learn Assembly Language for the processor you're working at
+ 1
Hello , pointers in c is most powerful and important part of c
You should learn about process memory layout , storage classes ,pointers ,arrays ,pointers vs arrays
Some useful links:
https://www.guru99.com/c-pointers.html
https://www.geeksforgeeks.org/pointer-vs-array-in-c/amp/
https://www.google.com/amp/s/www.geeksforgeeks.org/difference-pointer-array-c/amp/
https://www.geeksforgeeks.org/storage-classes-in-c/amp/
https://www.geeksforgeeks.org/memory-layout-of-c-program/amp/
https://www.edn.com/5-simple-steps-to-create-an-abstract-data-type-in-c/
Some code bits:
https://code.sololearn.com/cRxl2h70gIy1/?ref=app
https://code.sololearn.com/cA3hAVyZgZam/?ref=app
https://code.sololearn.com/chSelf4s6USl/?ref=app
https://code.sololearn.com/coE1jUrfZMfd/?ref=app
https://code.sololearn.com/c0v5se3MWXC2/?ref=app
0
👍
0
Thank you, so, would tou suggest i start with C or an easier language?