Is defining a variable necessary ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is defining a variable necessary ?

In C # on pc, what changes between defining a variable and just declaring it? It's a bit of a vague question, I don't know how program memory is allocated and I don't know what CLR does when executing the code. I would like to know the difference in the process memory level.

4th Jan 2022, 10:07 PM
Mick - avatar
3 Answers
+ 3
You won't understand that by learning abstract and high-level programming languages like C#, C++, Java, Python etc. Also, Python is a shortcut programming language which is worse for beginners. Learning it, you won't be able to understand (maybe never) how a machine works or how programming is working on a deeper level. You need a C course mixed with some terms from Computer Architecture (what a CPU executes, what memory gives to CPU etc.) Or you can learn Assembler. But, learning high-level and abstract programming languages is not the way for a solid programming knowledge, because these languages are optimised for easy, rapid and efficient software development, and not for knowledge-based purposes.
4th Jan 2022, 10:36 PM
Romeo Cojocaru
Romeo Cojocaru - avatar
Martin Taylor Do you want to give me a lecture on programming languages? Why do you bring "data types" as a factor for defining a machine architecture? Does anyone have "char" as a fundamental data type as C have? Or all the languages (that I mentioned) have "string"? As "string" being a pointer to a "char" only C can teach you what memory is in computer programming. On the "garbage collector" I agree, it is a factor for defining a low / high level programming language. For more on a subject: "Is C a Low Level Language? Opinions are mixed!" [1] [1].
5th Jan 2022, 1:42 AM
Romeo Cojocaru
Romeo Cojocaru - avatar
- 2
Martin Taylor Too long, didn't read! As you did with my link. C is a low-level programming language and opinions are mixed if you did read that. In the future, please don't replay to me anymore, but directly to the topic author. Also, you are not in the position to give lectures.
5th Jan 2022, 9:07 AM
Romeo Cojocaru
Romeo Cojocaru - avatar