0
How can I manage to resolve Popsicles challenge in C, using ternary operator (conditionnal expression) ?
Here is one of my attempts to solve this, using ternary operator. Comment part with // is working correctly. I just tried to do it another way, using conditionnal expression (y = (x >= 5) ? 5 : x;) as it's demonstrated in Sololearn C course. Please give me hints first rather than the exact solution. https://code.sololearn.com/cPXUwQSvb3Uz/?ref=app
4 Respuestas
+ 3
You used the ternary correctly.
It's just that the type of res is not correct because you cannot assign an array of characters to another array of characters like that.
My hint:
Arrays in C really like to decay into what?
+ 1
I made a few changes, and this solution works.
https://code.sololearn.com/cLvveNU9t5bB/?ref=app
0
Thank you for your hint Dennis , I just get back to the lesson and finally find the solution !
0
Thank you Quantum, I found the solution and compare my code to yours. I still have some improvements to do !