Difference beetween void, int and bool? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Difference beetween void, int and bool?

I’m very new to c++, in fact I’ve never done any code before. I’m taking lessons on Udemy, but so far I dont know what these three are used for?

12th Oct 2017, 12:13 AM
Puny Pixel Privateer
Puny Pixel Privateer - avatar
5 Answers
+ 8
I see you have started the C++ course here. These data types are also explained in the SL course as you proceed with it.
12th Oct 2017, 2:19 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
Don't worry about void then. Worry about void when you get into functions. int is a whole number. int a = 263; bool is either true or false! (or 1 for true and 0 for false) bool b = true; bool c = 4 == 4; // true! bool d = 1; // true!
12th Oct 2017, 12:17 AM
Rrestoring faith
Rrestoring faith - avatar
+ 1
void - no type int - a positive or negative integer, ex. 1, 5, -2 bool - an integer, 0 means false, 1 means true
12th Oct 2017, 12:22 AM
aklex
aklex - avatar
+ 1
if you don't like to return any value then use void, if you would like return integer value then use int and if you like to return true/false value the use bool.
12th Oct 2017, 12:51 AM
VIRAL PARMAR
VIRAL PARMAR - avatar
0
void returns Nothing, int returns integer and bool return Boolean value ( true/false)
12th Oct 2017, 12:19 AM
Nura Programmer
Nura Programmer - avatar