Why do a Coder in the beginning keep on getting errors like "void value not ignored as it ought to be" in C++?

void value not ignored is an error caused when you try to assign an lvalue the result of a function returning void. Functions that return void do not return anything and can not be used as rvalues, they have no value. Functions that return void are side-effect only operations.

  1. void myFunc() { /* do thing */ }
  2. int main()
  3. {
  4. int a = myFunc(); // void value not ignored
  5. return 0;
  6. }


Comments

Popular posts from this blog

What is the BEST way to Practice "Cracking the CODING Interview Problems?

Basic HTTP Server Using NodeJS From Scratch

Which laptop Should you Buy for Intense Programming(i.e.to develop advanced projects)