So, reference variables would still be memory adresses to the variable the've been set to point to, just in a safer way because it disallows certain behavior of pointers? and also they seem to get derreferenced automatically
Great question Brandon! :-) Technically a reference is an alias for another variable. So it's not really a pointer, so much as it is just another way of accessing another variable. Which is something we can do with pointers too, so yes as a practical matter it does feel like a 'safer' constant pointer with automatic dereferencing. But technically, within the C++ language, it's just another name and way to access another variable. We could say that a pointer points to another variable, but a reference *is* the variable.
@@PortfolioCourses Oh it's just that I got confused by the use of the & which in C was to reference a variable's memory adress, so I thought here it was more or less the same principle, and also I didn't see in first sight why would I want an alias variable, thank you for the fast answer, I'm introducing myself from C to C++ with this playlist, also I take the opportunity to suggest the video ideas of lambdas(interested in the functional programming features of cpp), smart pointers and RAII pattern, thanks again, I also used the C playlist to get deeper into that
11:15 what if the function accepts many arguments of different types ?
So, reference variables would still be memory adresses to the variable the've been set to point to, just in a safer way because it disallows certain behavior of pointers? and also they seem to get derreferenced automatically
Great question Brandon! :-) Technically a reference is an alias for another variable. So it's not really a pointer, so much as it is just another way of accessing another variable. Which is something we can do with pointers too, so yes as a practical matter it does feel like a 'safer' constant pointer with automatic dereferencing. But technically, within the C++ language, it's just another name and way to access another variable. We could say that a pointer points to another variable, but a reference *is* the variable.
@@PortfolioCourses Oh it's just that I got confused by the use of the & which in C was to reference a variable's memory adress, so I thought here it was more or less the same principle, and also I didn't see in first sight why would I want an alias variable, thank you for the fast answer, I'm introducing myself from C to C++ with this playlist, also I take the opportunity to suggest the video ideas of lambdas(interested in the functional programming features of cpp), smart pointers and RAII pattern, thanks again, I also used the C playlist to get deeper into that
Those are all great ideas and videos I want to make one day. :-) I'm glad you're enjoying the playlists!
Your are awesome.
Thank You!
Please make video for add line numbers to a file . The file name should be as command line arguments
Thank you for the idea! I will add this to my list of video ideas. :-)
I just published the video now: Add Line Numbers To A File | C Programming Example
ua-cam.com/video/MbDwut1b1hE/v-deo.html. :-)