Here is my code, and my error message is, "error C4716: 'decToBinary': must return a value" Basically, I want the user to input an integer and have the program return the binary expansion in reverse order. How do I go about fixing this? Thank you!
Asked
Active
Viewed 578 times
-10
-
8Please post code as text, not as an image. – Scott Hunter Jan 23 '20 at 19:17
-
you can use `std::bitset` – 463035818_is_not_an_ai Jan 23 '20 at 19:18
-
When you don't want to return a value from your function, use `void` – Ben Jones Jan 23 '20 at 19:26
-
http://www.cplusplus.com/doc/tutorial/functions/#void – Ben Jones Jan 23 '20 at 19:27
1 Answers
3
The error message is pretty clear: you declared that your function would return an int
, but you never did.

Scott Hunter
- 48,888
- 12
- 60
- 101
-
And it was declared to return a single `int` not an array of 32 integers. – drescherjm Jan 23 '20 at 19:19
-
@drescherjm how does one declare a function that returns an array of 32 integers? – Aykhan Hagverdili Jan 23 '20 at 19:21
-
-
2Maybe `std::array
` although a `std::string` probably is a better choice if you can't use `std::bitset` instead of this. – drescherjm Jan 23 '20 at 19:23