why we sometimes write void instead of int? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why we sometimes write void instead of int?

2nd Apr 2019, 8:35 AM
Nilotpal Deka
Nilotpal Deka - avatar
3 Answers
+ 7
Why? I mean, do we? How would that look: int void() { ..... } ?
2nd Apr 2019, 8:41 AM
HonFu
HonFu - avatar
+ 4
Do not forget to use a search engine before asking questions. https://www.sololearn.com/Discuss/583759/?ref=app
2nd Apr 2019, 8:47 AM
Solo
Solo - avatar
+ 1
Use void for functions that don't have any return type like printing a text out on z screen. Some weird compilers use it *cough*turbo*cough* But the most common types are int. We use int for a function that has a return type. most compilers use int in there main function.
2nd Apr 2019, 5:37 PM
Nehemiah Aklil
Nehemiah Aklil - avatar