LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-22-2018, 12:39 AM   #1
shlomo.hovir
Member
 
Registered: Oct 2018
Posts: 66

Rep: Reputation: Disabled
why void is used


i know void is optional sometimes when u dont want to return an integer and nor a return value but why wouldn don't want to not return an integer of success
give me with an example
 
Old 10-22-2018, 04:57 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,844

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
just because you are not interested.
As an example:
Code:
global var;
function set_var(value) {
  var = value;
}
and this cannot fail. But obviously you need to specify better the environment/language you use, otherwise hard to say more.
 
Old 10-22-2018, 01:02 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Code:
void printHelloWorld()
{
    cout << "hello world!\n";
}

printHelloWorld();
You really couldn't imagine this?

/me puts the help vampire on ignore list

Last edited by dugan; 10-22-2018 at 01:06 PM.
 
3 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Void Linux gave itself to the void, Korora needs a long siesta -- life is hard for small distros LXer Syndicated Linux News 0 05-16-2018 09:50 AM
Void Linux is... void black-clover Linux - Networking 8 11-23-2017 08:04 PM
pthread giving error: invalid conversion from ‘void* (*)(int*)’ to ‘void* (*)(void*)’ knobby67 Programming 4 05-05-2017 10:54 AM
(void)time(&cur_time); Why did the author put (void) here? e3399 Programming 3 03-28-2011 11:45 AM
void main(void) linuxanswer Programming 4 10-26-2003 12:37 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration