473,890 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

the different between function and procedure for C/C++ and Pascal

hello anyone...

pls explain me , how different between function and procedure for C/C++ and Pascal.

Thankx......

Nov 14 '05
14 23451
"digital" <di*******@from ru.com> wrote:
# hello anyone...
#
# pls explain me , how different between function and procedure for C/C++ and Pascal.

A procedure is void function. A function is nonvoid function.
Instead of assigning to the function name, assign to a local variable with
the same type, say result, and add a return of that at the and

procedure P; begin void P() {
... ...
end }

function F: T; begin T F() {T result;
... ...
F := x; result := X;
... ...
end; return result;}

--
Derk Gwen http://derkgwen.250free.com/html/index.html
She broke your heart and inadvertendentl y drove men to deviant lifestyles.
Nov 14 '05 #11
pete <pf*****@mindsp ring.com> wrote in message news:<40******* ***@mindspring. com>...
pete wrote:

August Derleth wrote:

Christopher Benson-Manica wrote:
> lallous <la*****@lgwm.o rg> spoke thus:
>
>
>>The 'void' as a return type is used to denote that
>>function has no return type.
>
>
> FMI, is this statement identical to "... function does not return
> anything?"
>

It's a clumsy and possibly pedantically incorrect
way of saying it,


I think that's a good way of saying it.


Refering to "... function does not return anything"
but I think that's what lallous means.

(Perhaps lallous could have said `does not return an object of a
usable type',
since trying to inspect or modify an object of void type is not
allowed in C. But that's, again, rather clumsy compared with `does not
return any value.', and could be technically incorrect.)


I think that's worse.
The return value of a function is an rvalue, not an object.

--
pete
Hello,
>>The 'void' as a return type is used to denote that
>>function has no return type.
>
>
> FMI, is this statement identical to "... function does not return
> anything?"
>

It's a clumsy and possibly pedantically incorrect
way of saying it,


I would be glad to learn how to say it correctly in technical terms.

Or simply, if said again (drawing from previous posts): "It does not
return a usable value" ?

--
Elias
Nov 14 '05 #12
lallous wrote:

pete <pf*****@mindsp ring.com> wrote in message news:<40******* ***@mindspring. com>...
pete wrote:

August Derleth wrote:
>
> Christopher Benson-Manica wrote:
> > lallous <la*****@lgwm.o rg> spoke thus:
> >
> >
> >>The 'void' as a return type is used to denote that
> >>function has no return type.
> >
> >
> > FMI, is this statement identical to "... function does not return
> > anything?"
> >
>
> It's a clumsy and possibly pedantically incorrect
> way of saying it,

I think that's a good way of saying it.


Refering to "... function does not return anything"
> but I think that's what lallous means.
>
> (Perhaps lallous could have said `does not return an object of a
> usable type',
> since trying to inspect or modify an object of void type is not
> allowed in C. But that's, again, rather clumsy compared with `does not
> return any value.', and could be technically incorrect.)

I think that's worse.
The return value of a function is an rvalue, not an object.

--
pete
Hello,
>>The 'void' as a return type is used to denote that
> >>function has no return type.
> >
> >
> > FMI, is this statement identical to "... function does not return
> > anything?"
> >
>
> It's a clumsy and possibly pedantically incorrect
> way of saying it,


I would be glad to learn how to say it correctly in technical terms.

Or simply, if said again (drawing from previous posts): "It does not
return a usable value" ?


The first way to say it that pops into my head is
"it doesn't return anything."
"It does not return a usable value", would be a subset
of that statement. Returning a value, is done by writing
the return value to someplace that the calling function
will have access to read.
A function with a void return type, doesn't have to do that.

--
pete
Nov 14 '05 #13
digital wrote:
What is the difference between function and procedure for C/C++ and Pascal.


Procedures are only possible in *imperative* computer programming
languages like Fortran, Pascal, C, C++, etc.
The *thread* of execution normally *proceeds* from one imperative
(executable statement) to the next. Flow control "structures "
such as conditionals, loops, switch, case, etc.
may change the normal sequence of execution.
Within the context of each imperative computer programming language,
procedures which return a value are called functions:

language returns value no return value
-----------------------------------------------
C/C++ function void function
Fortran function subroutine
Pascal function procedure

Note that functions need not be procedures:

int min(int i, int j) {
return (i < j)? i: j;
}

and simply return the value of an expression.
It is possible to write useful C programs
without any imperatives at all -- no procedures!
An *applicative* of "functional " programming language
like lisp has no imperatives and, thus, *no* procedures.

Nov 14 '05 #14
August Derleth <se*@sig.now> wrote in message news:<js******* **********@fe02 .usenetserver.c om>...
C++ and Pascal are offtopic, but discussing the differences between them
and C isn't verboten


comp.lang.c is for the discussion of C as pertains to the relevant standards.
Nov 14 '05 #15

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

Similar topics

2
2614
by: m.j | last post by:
Hi, How to convert this pascal(delphi) function into java? The function is used in a algorithm. The trouble is that java don't have any unsigned 32bit type. What the trick, when you cannot do bit shifting probaly, because only signed types are aval.?
19
2804
by: Karl Scalet | last post by:
Hi, quite often there is a need to just print out the items of a list. that would be nice, except prt() does not exist, and print is a statement not a function, hence cannot replace prt as of above. I don't like to write d
2
5026
by: Mich | last post by:
I'm going crazy trying to convert an Access Function to SQL. From what I've read, it has to be done as a stored procedure. I'm trying to take a field that is "minutes.seconds" and convert it to minutes. This is what I have in Access: Function ConvertToTime (myAnswer As Variant) Dim myMinutes myMinutes-(((((myAnswer * 100)Mod 100/100/0.6)+(CInt(myAnswer-0.4)))) ConvertToTime =(myMinutes)
8
2973
by: Muthu | last post by:
I've read calling conventions to be the order(reverse or forward) in which the parameters are being read & understood by compilers. For ex. the following function. int Add(int p1, int p2, int p3); The parameters here can be read either in the forward order from p1 till p3 or reverse order from p3 till p1. Can anyone explain what is the advantage/disadvantage of either of
6
8002
by: Daniel Nichols | last post by:
I've noticed that in a C module (.c, .h file combination) that if you create a function's definition before it is used in other functions than a declaration is not necessary. I believe if the compiler can find the definition of the function prior to encountering the use of the function it will generate the prototype itself. I don't currently use this feature, I explicitly create declarations for all functions in a header file. However, I...
26
3148
by: Adam Warner | last post by:
Hello all, I'm very new to C but I have a number of years of Common Lisp programming experience. I'm trying to figure out ways of translating higher order concepts such as closures into C. The code will not be idiomatic C. GCC has an extension to ISO C that permits nested functions: <http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html> For implementing closures they have a serious limitation:
82
12679
by: zardoz | last post by:
I've got this problem: unsigned long long lTemp; char cLargeNum="1324567890"; sscanf(clargeNum,"%llu",&lTemp); which under Win32 isn't working*. My program needs to compile under posix so no Win32 specials allowed....
4
3374
by: cantatahost | last post by:
Hello, Likely this has been asked before... We have a library (in DLL form) that we distribute. The interface to the library is all C, but within the library it uses C++ in many places. Traditionally we've built our library with VC 6. We are considering moving to VS .NET 2003 or VS 2005. However, we'd like to retain the ability to link applications with the library when the application is still built with VC 6.
9
2703
by: serge | last post by:
/* Subject: How to build a procedure that returns different numbers of columns as a result based on a parameter. You can copy/paste this whole post in SQL Query Analyzer or Management Studio and run it once you've made sure there is no harmful code. Currently we have several stored procedures which final result is a select with several joins that returns many
0
9979
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9826
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10829
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9640
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7171
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5854
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6058
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4682
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.