+ 12
how to return an array in c .
unfortunately im having a problem that i need to write a function in C that returns an array but i did'nt study pointers yet , so my question is , is it possible to return an array value without using pointers ?
10 Respuestas
+ 4
C programming does not allow to return an entire array as an argument to a function. However, you can return a pointer to an array by specifying the array's name without an index.
+ 6
Baptiste E. Prunier haha ! Thank you , ill keep this code saved for the next year , coz we did'nt quiet get into data structures in the first year . But i appreciate your answer ^^ .
+ 6
Baptiste E. Prunier Yep it surely is :).
+ 5
You can return array like that, even though it is quiet ... unusual ^^
https://code.sololearn.com/cvvS26r7f118/?ref=app
+ 5
TA .A you are welcomed :) Hope it'll be of some help !
+ 3
Frank Abagnale oh got it , so then i can loop over this array by the pointer i returned right ?
+ 3
Frank Abagnale Thanks man !
0
Sure, you can loop over the array.