C++ Programming Tutorial 68 - Swap Function with Pass by Reference

C++ Programming Tutorial 68 - Swap Function with Pass by Reference

Caleb Curry

5 лет назад

26,827 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@guitarhax7412
@guitarhax7412 - 20.08.2019 00:18

Okay, this one really tied in in better. You almost lost me last video. This was a good enforcer.

Ответить
@bennythinker4659
@bennythinker4659 - 17.12.2019 15:51

awesome video

Ответить
@rdawo6408
@rdawo6408 - 19.11.2020 17:42

can we use it for strings?

Ответить
@kern68
@kern68 - 29.12.2020 03:03

After watching episode 66-68 I extrapulated that const should be used only when passing arrays to functions. Since all other types are passed by value unless you want the function to have the ability to change the value. Am I understanding this correctly?

Ответить
@spinity8468
@spinity8468 - 03.02.2021 06:17

This code is really good Caleb! :D Thanks!

Ответить
@PunmasterSTP
@PunmasterSTP - 31.07.2021 20:58

Hey, did you hear about this IDE that dogs can use to code? ...Sorry, I forgot the punchline. Maybe it was related to a sponsor or something?

Ответить
@otsutsukiboruto8833
@otsutsukiboruto8833 - 12.04.2022 01:25

Thank you so much

Ответить
@jonverperfecto3330
@jonverperfecto3330 - 19.06.2022 08:51

Thanks

Ответить
@MorbidPasta
@MorbidPasta - 21.06.2022 17:57

The way that I swap ints without using a temp if anyone is interested:
void swap(int &a, int &b){
a = a + b;
b = a - b;
a = a - b;

std::cout << a << ", " << b << "\n";
}

Ответить
@DieGedankenSindFrei0
@DieGedankenSindFrei0 - 05.10.2022 23:47

What about swapping back to the original numbers? I want to swap to use for calculation purposes, but then use the original numbers for printing purposes. New to C++. TIA!

Ответить
@aaronzewdu
@aaronzewdu - 17.10.2022 02:19

Fantastic example

Ответить
@kabarii
@kabarii - 11.12.2022 00:23

THANK GOD bro i was going insane wondering why the numbers weren't swapping, its cause i forgot the &

Ответить
@advaithrvasistha44
@advaithrvasistha44 - 19.03.2024 18:56

tnks

Ответить
@72Yusif
@72Yusif - 02.05.2024 08:55

Please tell me how i can do it without any integer on my code. I want to just type two numbers on terminal then i want to got output . For example
Terminal:
10 5
5 10.
. I want to do exactly like that. And i want to left 1 space beatwen integers on terminal also. Beside i want to write just function on my code to implement this output on my terminal.

Ответить