C program | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

C program

Can you help me guys to find error.this program is based on user-defined functions. https://code.sololearn.com/ct4Q8tMCTUnT/?ref=app

29th May 2020, 2:22 PM
Paul
Paul - avatar
2 Réponses
+ 1
You are returning your counter 'c' within the first iteration. You have to return it after the loop has finished.
29th May 2020, 2:29 PM
Sandra Meyer
Sandra Meyer - avatar
+ 1
Btw. you could replace 'n' with sizeof(arr) / sizeof(arr[0]) what would make it a little bit more robust.
29th May 2020, 2:30 PM
Sandra Meyer
Sandra Meyer - avatar