+ 1

What's the difference between definition and declaration in C++?

And can I call parameter a variable?? What's the difference between reference and variable?

25th Apr 2021, 4:40 PM
Mohammad Mehedi Hasan
Mohammad Mehedi Hasan - avatar
9 Réponses
+ 3
Declaration of a variable is for informing to the compiler the following information: name of the variable, type of value it holds and the initial value if any it takes. i.e., declaration gives details about the properties of a variable. Whereas, Definition of a variable says where the variable gets stored. no, you can't call a parameter as variable. Variables are kinda label for the memory that stores the actual data. Pointers stored the address of the variables. References are alias for the variables.
25th Apr 2021, 4:58 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
...the title and description aren't matching. do you wanna ask about all four or any two?
25th Apr 2021, 4:48 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
Coding Kitty Does function hold space in memory too?
25th Apr 2021, 5:00 PM
Mohammad Mehedi Hasan
Mohammad Mehedi Hasan - avatar
+ 1
they do. even if you don't call them in the main function. but you shouldn't be concerned about that for now.
25th Apr 2021, 5:02 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
Coding Kitty I am sorry for this All four..
25th Apr 2021, 4:52 PM
Mohammad Mehedi Hasan
Mohammad Mehedi Hasan - avatar
0
Mirielle Ok, variable declaration and defination - ✅ But are you calling parameter a variable?? Coding Kitty said, parameters and variables aren't same...:/ I don't get it..
25th Apr 2021, 9:22 PM
Mohammad Mehedi Hasan
Mohammad Mehedi Hasan - avatar
0
Mirielle https://code.sololearn.com/cq1S7wD2B9vx/?ref=app Here parameter has an adress too.. 🤔 Whatever, I ran the program 10-12 times and it's changes memory location.. Can you please search for where did I go wrong??
25th Apr 2021, 10:07 PM
Mohammad Mehedi Hasan
Mohammad Mehedi Hasan - avatar