c++ void function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

c++ void function

If your function starts with void instead of int or anything does that mean it dosnt need to output anything?

21st May 2017, 7:30 AM
Kyroh
Kyroh - avatar
2 Answers
+ 4
It means it does not return anything, not necessarily not output anything. You could have an output function inside the function that displays something.
21st May 2017, 7:39 AM
Karl T.
Karl T. - avatar
0
Void means nothing is stored in the eax or rax register before it goes back to the caller's subroutine. (Sometimes its stored using more Than one register or is put on the stack if it's too big for the eax/rax register). Essentially that means it returns nothing. Anything else like int does
21st May 2017, 8:12 AM
aklex
aklex - avatar