Programming in C—Functions.steemCreated with Sketch.

in hive-175254 •  5 years ago 
Hello Everyone

images.jpeg

Image Source

I hope you all are fine and safe inside your homes. This is a weird time ongoing in the whole world and I hope it will get over soon. As during this time, everyone is locked into their homes. I want to share the C programming language with you. I hope you guys like it, so let's happen today's topic.

Function Prototype

A function prototype is just the declaration of a function that specifies function's name, parameters and return type. It doesn't contain function body.
A function prototype gives information to the compiler that the function may later be employed in the program.
Syntax of Function Prototype

returnType functionName(type1 argument1, type2 argument2,...);

The function prototype isn't needed if the user-defined function is defined before the main() function.

Function Definition

Function definition contains the block of code to perform a selected task i.e. during this case, adding two numbers and returning it.
Syntax of Function Definition

returnType functionName(type1 argument1, type2 argument2, ...)
{
 //body of the function
}

When a function is termed, the control of the program is transferred to the function definition. And, the compiler starts executing the codes inside the body of a function.

Function Call

Control of the program is transferred to the user-defined function by calling it.
Syntax of Function Call

functionName(argument1, argument2, ...);

Logo.png

Thank you.

I hope you guys liked my post.

Keep Supporting.

STAY TUNED FOR NEXT POST

UPVOTECOMMENTRESTEEM
IF YOULIKEDMY POST

Logo.png

Created by @zord189

Stay Home, Stay Safe

@peerzadazeeshan

PEACE✌️✌️

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi! Did you know that steemit.com is now censoring users and posts based on their opinions?
All the posts of these users are gone!
https://github.com/steemit/condenser/commit/3394af78127bdd8d037c2d49983b7b9491397296

Here's a list of some banned users:
'roelandp', 'blocktrades', 'anyx', 'ausbitbank', 'gtg', 'themarkymark', 'lukestokes.mhth', 'netuoso', 'innerhive'
See anyone you recognize? There could be more, they also have a remote IP ban list.

Will you be censored next?

As a follower of @followforupvotes this post has been randomly selected and upvoted! Enjoy your upvote and have a great day!

Compiler doesn't execute code inside functions, it just generates code for linker. Linker combines program code with necessary libraries and start-up code.

Run-time loader is the one that loads and executes the compiled and linked code.

Compiler can execute code inside function but the code inside function should be another function. It can be done by RECURSION so called the Recursive Function...
Cheers.

Nope... Compiler doesn't execute anything... Recursive functions don't need any executing from compiler as it is the linker that handles addresses of functions, not compiler.

Compiler might inline function inside another function or class member, but it doesn't try to execute the code in the function.

If compiler would try to execute any user code, cross-compilers wouldn't work at all.

Linker links the object code to library files and makes final machine code.
Loader helps the code to get executed...

Linker also writes the final symbol table and adjusts the object code so that different compilation units can find functions not local to themselves.

Most executables have base address added by linker that is used to calculate relative addresses for functions. Run-time loader can relocate the executable if two executables have same base address.

If supported and enabled, linker can also make final optimizations to the object code (LTO, link-time optimization).

Well Thanks for the information, honestly I haven't any knowledge about this.
Cheers.

I've been developer for over 35 years and helped fixing bugs in gcc and Visual C++ compiler.

Alright..
Nice to meet you here...