473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to quit void functions

Hello.

I have a void function.

Now, how do I exit the function at a random line in the code?

Normally I would use the return statement.

Thanks.
Nov 14 '05 #1
2 13692
Martin Johansen wrote:
Hello.

I have a void function.

Now, how do I exit the function at a random line in the code?

Normally I would use the return statement.


To return from the function at any specified point use the return
statement. Exiting randomly is not a good idea.
Nov 14 '05 #2
>I have a void function.
Now, how do I exit the function at a random line in the code?

Normally I would use the return statement.


Use the return statement.

void logerror(char *msg)
{
if (msg == NULL) {
return;
}
if (msg[0] == '\0') {
return;
}
... stuff to output the string pointed at by msg to a log file ...

return; /* optional */
}

Gordon L. Burditt
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Maximus | last post by:
Hi, I was just wondering, is it good to use return without arguments in a void function as following: void SetMapLayer() { if( !Map ) return; layer = LAYER_MAP; }
23
by: REH | last post by:
The other day I did something like this: void foo { } void bar() { return foo(); }
1
by: Hemanth Kumar P | last post by:
Hello Sir/Madam, I had declared a function as a non-void type as shown below: uinsigned int functn(int x, int y); While using this function in my program, I am getting the warning as ...
10
by: socondc22 | last post by:
I'm trying to figure out why my prof would want us to run a conversion of metric to english and english to metric through a void function and using call-by-reference. Also i was wondering if anyone...
4
by: jay123swe | last post by:
Hi. It's been a while since I was here last time and I've learned some things I hope. However I have to do some void functions that return other void functions. My problem isn't really how to do...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.