+ 2

Why my code produces error?

See my code below https://code.sololearn.com/cCBPHBNDZPN4/?ref=app

5th Nov 2021, 6:53 AM
Rishi
Rishi - avatar
8 Antworten
+ 2
You can't return it cause it's not there. Check this out, i added a pointer to the pointer in your function, then returned the double pointer. https://code.sololearn.com/cfuGzi1OOvh0/?ref=app
5th Nov 2021, 9:44 AM
Slick
Slick - avatar
+ 4
Thank you Martin Taylor and Slick =)
5th Nov 2021, 2:28 PM
Rishi
Rishi - avatar
+ 1
because you try and return a double pointer when it only needs a regular pointer. i just changed everything to reference a base level pointer. A double pointer would be good if you had multiple arrays of integers but we only worked with a single value
5th Nov 2021, 8:50 AM
Slick
Slick - avatar
0
Slick your code also does the same as mine, but in another way. Why does my code asking is not working?
5th Nov 2021, 8:46 AM
Rishi
Rishi - avatar
0
Slick I'm not understanding this =( Why can't I return a variable of data type pointer to pointer to an integer? It's not needed here, but still I can't get satisfaction because I'm not getting why this doesn't work.
5th Nov 2021, 8:58 AM
Rishi
Rishi - avatar