|
******************************************
Welcome To CrazyEngineers (CE) – an online community of engineers from all over the world! With the younger CEan at 84 and the youngest at 16, CE boasts of professional engineers, students, professors, entrepreneurs, CEOs, geeks & nerds. We exchange innovative ideas, share knowledge, help each other and expand our worldwide network of engineers! You need not have a formal degree in engineering to be a part of CrazyEngineers! Need we say more? Join CE! | Be a CE Ambassador! | Forgot password? | Sponsor CE | Contact Us |
![]() |
| Sponsored links | |
|
|
|
|
CE - Newbie
![]()
I'm a Crazy Computer Science Engineer
Join Date: 26th November 2006
Posts: 9
|
hi
Last one is correct(Amit) #include<stdio.h> void display(); // it is declaration int main() { display(); // here it is called } // now here is defination of function void display() { printf(" my name is XYZ"); } ///it so simple.. |
|
|
|
|
CE - Newbie
![]()
I'm a Crazy computer Engineer
Join Date: 12th August 2008
Posts: 5
|
hi i am pri.... actuall dis is my 1st post so i dnt no whether i m posting it to the right place or not.....
i am in desperate need of a topic artificial inteligence on which i want to present a paper.....i feel engineering is absolutely not interesting until u do something technical....so please guide me ...
__________________
priya |
|
|
|
|
CE - Apprentice
![]() ![]() |
Hi.. One more additional point is that..
Function Definitions also known as proto-type, they are just an intimation given to the Compiler that I will be using the proto typed function in the future code execution. The syntax for Prototype is: <Return type> <Function Name>(Argument Data Types); Here semicolon is a must, and must be declared before the Function Definition. Whereas when a function is called the code which is executed is Function Definition, with a syntax: <Return Type> <Function Name>(arguments and their Datatypes)// No semicolon { Body of the code } Where as if we consider a variable. when you declare: int a; you are telling the compiler that I am going to use a variable 'a' as an integer variable, please allocate space for it. So here 'a' stores the address which is allocated by the compiler. When you say a = 5; The value 5 is set to the location 'a' in the memory. Hope this was helpful..
__________________
Regards, Mrunalini ![]() |
|
|
|
|
CEan - Value Adder
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Ill keep the difference simple.
Declaration - you are announcing to the compiler, that such and such function exists. This one shows the existence. Definition - you are displaying to the compiler, the exact working of such and such function. This one shows the innards and the existence. |
|
|
|
|
Moderator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
I'm a Crazy Communications Engineer
Join Date: 12th July 2007 Location: IIUM, Malaysia
Posts: 1,506
|
Ah.. can I use an analogy like this?
Declaration: Mobile phone brand X Definition: 3G, SMS, mobile gaming, mp3 music, organizer etc etc..
__________________
Keep it simple. Keep it real. | New to CE? Click here! | Join our CE Bot project! | Problems? Questions? PM or mail me at ash{at]crazyengineers{dot]com |
|
|
|
|
|
CE - Newbie
![]()
I'm a Crazy COMPUTER SCIENCE Engineer
Join Date: 17th August 2008
Posts: 1
|
hi,in definition,variable space is allocated for variable and for some initial value.
In declaration only intenifies the type of variable for function.In simple word in definition memory space is allocated. In declartion refer to the place where the variable nature is stated,no allocation is done. for example void show()\\"declaration"// { printf("singh is king"); } #include<stdio.h> void main();\\"definition" { void show(); clr scr(); show(); getch(); } |
|
|
|
| Sponsored links | |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| Contact Us - Home - Impressum | Impressum - |