0

Explanation about space and storage on C.

Hey I been studying C for my exams and I am new to C and when I read comments,I see a lot of people talking about storage and waste of space and stuff like that I haven't even encountered that yet in solo course.It's just bugging me and if someone well acquainted in that can tell .Then I am all ears. (Also perhaps/maybe my first question. Yey!!!!)

30th Aug 2021, 7:20 AM
Dr Doctor
Dr Doctor - avatar
2 Respostas
+ 4
Experienced coders used to talk about that, but I think it's more closely related to system programming or embedded programming. It is considered important in such fields because those who codes for such systems must be really careful - not to be wasteful, in terms of memory and storage usage. Memory and storage are limited and precious resources in such fields. SoloLearn targets new and fresh learners, that said, I don't really think the subject of resource usage carefulness is a high priority. Not saying it's unimportant, but where new learners have to confront such subjects, I guess it will be more of an obstacle rather than a motivation. Obviously anyone who had got through learning phase are free to advance forward, to learn that subject. Especially when the subject be closely related to their career.
30th Aug 2021, 7:38 AM
Ipang
+ 3
This should not be a problem if you are writing a small, compact program. In case you really want to make use of dynamic memory allocation, then use the malloc(), calloc(), realloc() and free() functions for C and the new and delete operators and vector library for C++. Apropos, dynamic memory allocation can slow down the program, as the memory is being allocated on runtime, as opposed to static allocation. So allocating memory dynamically can be the opposite of what you want. Edit: Not to mention its dangers concerning the inexperienced, if the allocated memory is not freed.
30th Aug 2021, 12:45 PM
Magnus
Magnus - avatar