How to return multiple values from a funtion back to main? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to return multiple values from a funtion back to main?

We were ask to make a function that has initialized array of grades and the funtion has to return grades above 75 in c

18th Jan 2020, 12:07 PM
Saziver Art
Saziver Art - avatar
3 Answers
+ 7
You have to pass the function a pointer to the result array, and modify it in the function via those pointers. That's the way to do it in C. I suggest continue with the sololearn course because you will find the explanation on the way. https://www.sololearn.com/learn/C/2934/
18th Jan 2020, 12:20 PM
Tibor Santa
Tibor Santa - avatar
+ 2
You can also create a struct. That can be returned as one object.
18th Jan 2020, 1:30 PM
HonFu
HonFu - avatar
0
Store above 75 grades in another array, and Return that array...
18th Jan 2020, 12:22 PM
Jayakrishna 🇮🇳