0

Return array from function in cpp

How can I return an array from a function to the main function?

26th Dec 2016, 6:26 PM
Matin Zadehdolatabad
Matin Zadehdolatabad - avatar
5 odpowiedzi
+ 1
int* getArr(int size) { int*arr = new int[size]; return arr; } int main() { int* a = getArr(10); a[0] = 1; delete[] a; }
26th Dec 2016, 6:47 PM
Vladislav
Vladislav - avatar
+ 1
About writing game?
26th Dec 2016, 6:53 PM
Vladislav
Vladislav - avatar
0
check my last post please
26th Dec 2016, 6:27 PM
Matin Zadehdolatabad
Matin Zadehdolatabad - avatar
0
@Vladislav can u see my last post?
26th Dec 2016, 6:53 PM
Matin Zadehdolatabad
Matin Zadehdolatabad - avatar
0
No its cpp project ... Please comment on my last post ... bubble sort
26th Dec 2016, 6:54 PM
Matin Zadehdolatabad
Matin Zadehdolatabad - avatar