-2

I see void a lot often in Java, C++ and C Programming Languages. I am actually Electrical Guy that is aspiring to be a Developer.

J.Doe
  • 131
  • 2
  • 7
  • 1
    void means nothing or having no type – Rahul Tripathi Feb 19 '16 at 07:38
  • 1
    you answered you own question in your question. Void means that a method does not return anything to the caller – Patrick Feb 19 '16 at 07:38
  • 1
    `void` means nothing or in another sense everything. :) – Gopi Feb 19 '16 at 07:39
  • 1
    @Patrick careful with the capitalization - whilst this question is asking about multiple languages, in Java `Void` and `void` mean different things. A method whose return type is `Void` must return a `java.lang.Void` reference (i.e. there must be an explicit `return` statement). – Andy Turner Feb 19 '16 at 07:44
  • Step 1 is to choose the language you want to study. Step 2 is to read a book. Here's a [list of books](http://stackoverflow.com/a/562377/3386109) about the C language. – user3386109 Feb 19 '16 at 07:47
  • "I am actually Electrical Guy that is aspiring to be a Developer" good for you, the world needs people with that skillset. But I'm pretty sure you didn't learn electrical engineering by pointing at a component on a print board and ask "what does that do?" – Gimby Feb 19 '16 at 09:09

1 Answers1

9

It means "no type". It is used as function argument, generic data pointer and function return value. For example, if your function return value is void (the one before the name of the function) like void ex_func (void) it means it doesn't return anything. Or if it's int ex_func (void) it takes no argument. Lastly, void * ex_data is a pointer to a data that is unspecified or unknown and therefore it can't be dereferenced. Dereferencing means getting the value that is stored in the memory pointed by the pointer.

More information on void type in case you're interested.

Ludwig
  • 432
  • 6
  • 17