- A function prototype - describes the structure of the function to the compiler.
- A function call - passes program control to the function.
- A function header - begins the program code of the function.
Function Prototype
void DoAction(void);
indicates that the function returns no value and receives no data.
Function Call
The function call passes control to the function.
DoAction();
Passes control to the DoAction function.
Function Header
The function header defines the function. The body of the function code is defined by { }.
// Sample code for Triangle Calculator #include<stdio.h>void CalculateArea(); // Function Prototype void main() { printf("Triangle Area Calculator"); CalculateArea(); // Function Call printf("Program Complete"); scanf("%*c"); } void CalculateArea() // Function Header { float Height, Base, Area; printf("Enter the Height "); scanf("%f%*c", &Height); printf("Enter the Base "); scanf("%f%*c", &Base); Area = Height * Base / 2.0; printf("The Area is %0.2f\n", Area); }
Helpful post, thanks for sharing this coding functions. It is really helpful. Keep up the good work and share more.
ReplyDeleteC++ Training | C Language Training
Glad you find the article helpful. :) happy coding!
ReplyDeleteI also have another blog I started recently for code snippets. Here is the link. https://georgesnippets.blogspot.com
I always enjoy reading quality articles by an individual who is obviously knowledgeable on their chosen subject. Ill be watching this post with much interest. Keep up the great work, I will be back
ReplyDeleteC and C++ Training Institute in chennai | C and C++ Training Institute in anna nagar | C and C++ Training Institute in omr | C and C++ Training Institute in porur | C and C++ Training Institute in tambaram | C and C++ Training Institute in velachery