Reference Variables | C++ Tutorial

  Рет қаралды 3,657

Portfolio Courses

Portfolio Courses

2 жыл бұрын

How to use reference variables in C++, including using references as parameters (pass-by-reference), using references as return values, and using a reference to a function. Source code: github.com/portfoliocourses/c.... Check out www.portfoliocourses.com to build a portfolio that will impress employers!

Пікірлер: 8
@germankoga8640
@germankoga8640 Жыл бұрын
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
@PortfolioCourses
@PortfolioCourses Жыл бұрын
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.
@germankoga8640
@germankoga8640 Жыл бұрын
@@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
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Those are all great ideas and videos I want to make one day. :-) I'm glad you're enjoying the playlists!
@yt-1161
@yt-1161 4 ай бұрын
11:15 what if the function accepts many arguments of different types ?
@rakshithabk1827
@rakshithabk1827 2 жыл бұрын
Please make video for add line numbers to a file . The file name should be as command line arguments
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Thank you for the idea! I will add this to my list of video ideas. :-)
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
I just published the video now: Add Line Numbers To A File | C Programming Example kzfaq.info/get/bejne/g8h0qtillsiVmHk.html. :-)
Member Initializer Lists | C++ Tutorial
23:10
Portfolio Courses
Рет қаралды 8 М.
this Keyword And Use Cases Explained | C++ Tutorial
10:30
Portfolio Courses
Рет қаралды 5 М.
ОСКАР vs БАДАБУМЧИК БОЙ!  УВЕЗЛИ на СКОРОЙ!
13:45
Бадабумчик
Рет қаралды 4,7 МЛН
路飞被小孩吓到了#海贼王#路飞
00:41
路飞与唐舞桐
Рет қаралды 66 МЛН
ОСКАР ИСПОРТИЛ ДЖОНИ ЖИЗНЬ 😢 @lenta_com
01:01
아이스크림으로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 53 МЛН
References in C++ Explained
15:03
Caleb Curry
Рет қаралды 97 М.
Pass By Reference | C++ Tutorial
10:21
Portfolio Courses
Рет қаралды 9 М.
Function Templates | C++ Tutorial
10:54
Portfolio Courses
Рет қаралды 6 М.
What is the Difference Between a Pointer and a Reference C++
7:58
Paul Programming
Рет қаралды 424 М.
are "smart pointers" actually smart?
9:44
Low Level Learning
Рет қаралды 71 М.
C++ Pointers - Finally Understand Pointers
15:56
Caleb Curry
Рет қаралды 208 М.
Operator Overloading Introduction | C++ Tutorial
8:01
Portfolio Courses
Рет қаралды 11 М.
why do void* pointers even exist?
8:17
Low Level Learning
Рет қаралды 335 М.
C++ Pass by Value, Reference, Pointer Explained
10:18
Caleb Curry
Рет қаралды 40 М.
Python Decorators in 15 Minutes
15:14
Kite
Рет қаралды 430 М.
😔 @Layaraoficial @CAMILOAGUILLONN #santi
0:31
Santi
Рет қаралды 11 МЛН
Эй Рамазан # DamirAgroDizel
0:17
DamirAgroDizel
Рет қаралды 7 МЛН
😔 @Layaraoficial @CAMILOAGUILLONN #santi
0:31
Santi
Рет қаралды 11 МЛН
Who has won ?? 😀 #shortvideo #lizzyisaeva
0:24
Lizzy Isaeva
Рет қаралды 56 МЛН
1 milyon bile izlenmedi 🫤😔🌼#youtubeshorts #funnyart #drawing #ronaldo
0:10
Рыбаки в шоке. Рыбалка. #рыбалка  #shorts
0:20
Жизнь Рыбака
Рет қаралды 10 МЛН