+ 1
Hi everyone, Pls when do we use the 'void' function at what instance do we use it??
4 Réponses
+ 7
Maybe you just want to display a message like a menu for example, or you use parameters by reference so they modify without having to return anything, or working with arrays (like sorting or setting values to it). The posibilities are many 😉
+ 4
when the function doesn't return anything (no return bla; in the function).
+ 3
If you don't want to return a value like intergers u can use void.
If u want to return a string or a char you can use void.I hope this helps,and I don't know a better way to explain that.😕
+ 1
If you want to perform an action without returning a value. Examples like printing/displaying results, sorting arrays passed by reference etc.