Hi guys! Whats the difference btwn void and int? This two stuffs complicate my brain | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hi guys! Whats the difference btwn void and int? This two stuffs complicate my brain

23rd May 2018, 10:14 PM
Ahmad Mustapha Sadauki
Ahmad Mustapha Sadauki - avatar
2 Answers
+ 4
Void methods do not return anything, and int method must return any number, for example... // int method public int a() { return 0; } // void method public void b() { }
23rd May 2018, 10:24 PM
Elmer Martens
Elmer Martens - avatar
+ 1
A void pointer can point to objects of any type but you can’t dereference it without a cast. an int pointer points to an integer Just imagine void as the absence of type and int as the type int
23rd May 2018, 10:53 PM
Max
Max - avatar