473,385 Members | 1,867 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,385 software developers and data experts.

behaviour of a function

Kindly explain what is meant by behaviour of a function ? Does it mean
what task the function performs - say for example finding the square
root of a function Or does it mean how a function performs the task,
that is, the way of accomplishing a task

Kindly give the body of a function explaining what is meant by
behaviour of a function.

Thanks
V.Subramanian

Sep 20 '07 #1
3 1585
su**************@yahoo.com wrote:
Kindly explain what is meant by behaviour of a function ? Does it mean
what task the function performs - say for example finding the square
root of a function Or does it mean how a function performs the task,
that is, the way of accomplishing a task

Kindly give the body of a function explaining what is meant by
behaviour of a function.
Read about "return values" and "side effects". If the function does
not have any of those, it has no behaviour.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 20 '07 #2
On Sep 20, 8:44 am, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
subramanian10...@yahoo.com wrote:
Kindly explain what is meant by behaviour of a function ? Does it mean
what task the function performs - say for example finding the square
root of a function Or does it mean how a function performs the task,
that is, the way of accomplishing a task
Kindly give the body of a function explaining what is meant by
behaviour of a function.

Read about "return values" and "side effects". If the function does
not have any of those, it has no behaviour.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May I request you to give example function bodies for these for me to
understand the behaviour.

Please excuse me if I am wrong in asking it.

Thanks
V.Subramanian

Sep 21 '07 #3
su**************@yahoo.com, India wrote:
On Sep 20, 8:44 am, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
>subramanian10...@yahoo.com wrote:
Kindly explain what is meant by behaviour of a function ? Does it mean
what task the function performs - say for example finding the square
root of a function Or does it mean how a function performs the task,
that is, the way of accomplishing a task
Kindly give the body of a function explaining what is meant by
behaviour of a function.

Read about "return values" and "side effects". If the function does
not have any of those, it has no behaviour.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

May I request you to give example function bodies for these for me to
understand the behaviour.
[snip]

This is a function with a return value:

int four ( void ) {
return ( 4 );
}

This is a function with a side effect:

void make_four ( int & i ) {
i = 4;
}

This is a function with a side effect that you cannot tell from the
signature:

void log_error_4 ( void ) {
std::cerr << "Encountered Error 4. Don't ask what that means.\n";
}
Best

Kai-Uwe Bux

Sep 21 '07 #4

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

Similar topics

4
by: Wayne Aprato | last post by:
I have a simple database which was originally written in Access 97. When converted to Access 2000 file format it ran flawlessly in Access 2002. I've just tried to run it in Access 2003 and I am...
2
by: Joona I Palaste | last post by:
AFAIK the C standard divides behaviour of different things into four classes. 1) Defined behaviour. The implementation must do exactly what the standard says. 2) Implementation-defined behaviour....
12
by: Emmanuel Delahaye | last post by:
Hi there, It is commonly accepted that a call to the getchar() function suspends the execution of the current program. I have not found any description of this behaviour in the standard (I may...
25
by: Nitin Bhardwaj | last post by:
Well, i'm a relatively new into C( strictly speaking : well i'm a student and have been doing & studying C programming for the last 4 years).....and also a regular reader of "comp.lang.c" I...
2
by: Vaddina Prakash Rao | last post by:
Hi all .. I describe here a wierd behaviour .. i dont understand why ... This could be very stupid aswell .. so please bear me .. I have been writing a program to accept multiple parameters and...
12
by: RoSsIaCrIiLoIA | last post by:
On Mon, 07 Feb 2005 21:28:30 GMT, Keith Thompson <kst-u@mib.org> wrote: >"Romeo Colacitti" <wwromeo@gmail.com> writes: >> Chris Torek wrote: >>> In article <4205BD5C.6DC8@mindspring.com> >>>...
31
by: DeltaOne | last post by:
#include<stdio.h> typedef struct test{ int i; int j; }test; main(){ test var; var.i=10; var.j=20;
23
by: g.ankush1 | last post by:
#include <stdio.h> /* 1st example int a() { return 1; }
26
by: Frederick Gotham | last post by:
I have a general idea of the different kinds of behaviour described by the C Standard, such as: (1) Well-defined behaviour: int a = 2, b = 3; int c = a + b; (Jist: The code will work...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.