How to return an array from a function

preview_player
Показать описание
At least once, we've all tried returning an array type from a function and it failed horribly. Here's how to do it properly.
Feel free to ask questions in the comments below!

---

Рекомендации по теме
Комментарии
Автор

Thank you!!! whole day tried to figure out but the man explained in 7 mins

amartuvshinpurevbaatar
Автор

I really enjoy how clearly you communicate these topics :) Thank you, sir!

vytautaskuklys
Автор

you absolute LEGEND, I spent soo many hours trying to realize why my program wasn't running holy shit, and now it all works thanks to you thank you so so so much

moritzr
Автор

nice vid, reading answers on stack exchange just made me baning my head against the wall. This was clear and straight to the point. Thanks !!!

nextzdota
Автор

Thank you for sharing. I was just practicing some C programming and bumped into the same problem. This video saved me a lot of time. THX❤

Amin-vqqd
Автор

Really nice explanation, I forget to do a malloc inside the function and my function returned nothing. Thank so much for the explanation. It's very clean o objective!

artcodezen
Автор

Thanks for this awesome explanation man! This really helped me as a beginner in c/c++ programing

ishaan
Автор

This clearly illustrated how I can use 2 dimensional tables with a pointer. Thank you very much.

mpi
Автор

Pointers allow you to access and change global variables (or variables in the main function anyway) from inside another function. It all makes sense now!

samleheny
Автор

this video was spot ON!! it helped me so much. Thank you.

jesusstudentbrett
Автор

Absolute legend, thanks for this video!

atiedebee
Автор

FINALLY I CAN FIND SOMEONE WHO EXPLAIN IT
NICE VIDEO!

alexmorales
Автор

Holy shit this blew my mind that you can do it this way. Poahhh well explained good sir

xfsn_archer
Автор

clear explanation of handling arrays in functions

canarese
Автор

A friend of mine gave me an alternative solution by using static int arr[5]; this way you don't need to pass a solution argument in the function, something I've considered a bit confusing. But the explanation about the stack memory was quite a thing ! Thank you

gersonchadijunior
Автор

You are awesome, I think you can make your dev c++ look great
it's classic theme without any editing

hashteraryal
Автор

this is exactly what i was looking for ty

sophiagnetneva
Автор

I think you can also return the array if you define the local variable (arr) as 'static' variable

Gregryful
Автор

In the video you teach very well how to do with one-dimensional arrays. Is it possible to perform a two-dimensional array return?

santosbpm
Автор

so what if i write a function to generate like a random array of integers.
then i want To pass the result(random array) To another sorting function (eg: selection) and display the results
is that possible .

yasminebouzguen