(C++ Question)Write a short note on ( void ) data type of about 4-5 lines

Now tell the meaning of -- 

void main()

void is a data type which is used before the functions which will not return any value.

void tells computer that the function will not return any value.

we can declare void data  types where we don't know that which data type will b stored in that variable.
 

 

meaning of void main()

we know main() is a function,  so void main() tells that main function will not return any value.

if we write only main() instead of void main(), there a error occurs telling that "main() function should return a value"

we can avoid it by returning a integer value from main function because integer is default return type in c++. or by using void main()

ex:-

main()

{

return 0;

}   

 

  • 1

 nitin have you taken PCM as your stream ? ................!!!!

  • 0

yes

  • 0

Thanks a lot Sudhanshu.Thumbs up for you.Keep in touch as not many students have taken C++ so we can help each other.And yes I have taken PCM with comp sci (C++).

And Sudhanshu tell me what does returning a value means?If we make a simple program for addition then also a value is returned. What's the difference between these two kinds of values?

  • 0

 sorry, i'm so late!!!!!!!!!!

both return, from main and from addition function, are same but difference is in function type, The main is heart for c++ program and it is like a simple function whereas the addition (+) function program is done on operator, you can change the function of + operator by using 'operator overloading' capability of c++. if u would like then i can send u operator overloading program for + operator.

  • 0
I want a answer 2+2
  • 0
SORRY 
  • 0

void is a data type which is used before the functions which will not return any value.
void tells computer that the function will not return any value.
we can declare void data  types where we don't know that which data type will b stored in that variable.
meaning of void main()
we know main() is a function,  so void main() tells that main function will not return any value.
if we write only main() instead of void main(), there a error occurs telling that "main() function should return a value"
we can avoid it by returning a integer value from main function because integer is default return type in c++. or by using void main()
both return, from main and from addition function, are same but difference is in function type, The main is heart for c++ program and it is like a simple function whereas the addition (+) function program is done on operator, you can change the function of + operator by using 'operator overloading' capability of c++. if u would like then i can send u operator overloading program for + operator.

  • 1
What are you looking for?