C Programming

Associate
Joined
28 Jul 2003
Posts
1,987
Location
The Moon
Hey people I am new to C and was wondering what does the term "void" actually mean / do? I see lots of programs with this in but have no idea what it does. I have searched on google but it has not clarified it for me.
 
Hey thanks for the help. I still am at odds to what it does specifically, a lot of that made no sense to me. I am awful when it comes to computers.
 
Durzel said:
A function doesn't have to return something for it to be useful. Most of the time when you want a function to return a value it's so you can work out whether whatever the function was supposed to do was a "success" or "failure".

You could have a function, for example, which just increments a counter that is stored globally (I'm over-simplifying the concept of passing variables by reference, etc).. that function doesn't need to return anything to the part of code that calls it.

OK I think I get it. So, perhaps, if you had a part of a program the just performs a calculation but does not need to show the answer, then one could use a void?
 
I hate c. I am trying to make a program which calculates all the prime numbers up to 1000. I don't understand this void business at all.
 
Back
Top Bottom