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

i cant figure this out

Rearrange the code to declare a function taking two integer and one char parameters. If char's value is "+", return the sum of the integer arguments. Otherwise, return the product of their multiplication. return a * b; int foo(int a, int b, char c) { return a + b; } } if (c == '+') {

8th Jan 2017, 4:48 PM
Jocelyn Boismier
Jocelyn Boismier - avatar
1 Réponse
+ 3
int foo(int a, int b, char c) { if (c == '+') { return a + b; } return a * b; } By default it will return a * b, unless c == '+'.
8th Jan 2017, 4:57 PM
Jean-Hugues de Raigniac
Jean-Hugues de Raigniac - avatar