Function Declaration in C — User Defined Functions

  • Function type (return type)
  • Function name
  • Parameter list
  • Terminating semicolon

Points to note — Function Declaration

  1. The parameter list must be separated by commas.
  2. The parameter names do not need to be the same in the prototype declaration and the function definition.
  3. The types must watch the types of parameters in the function definition, in number and order.
  4. Use of parameter names in the declaration is optional.
  5. If the function has no formal parameters, the list is written as (void).
  6. The return type is optional, when the function returns int type data.
  7. When the declared types do not match with the types in the function definition, compiler will produce an error.
  1. Above all the functions (including main).
  2. Inside a function definition.

Prototypes: Yes or No

Parameters Everywhere!

  1. in declaration (prototypes),
  2. in function call, and
  3. in function definition.

Category of Function Declaration




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Look at your corpus

The Power of “Defensive Pessimism” in Building Great Software

How to Red Hat Certify a Docker Image in 8 Steps: Everything You Need To Know

A 2-month journey with Cordova, Clojurescript and final thoughts

Mediapipe 安裝教學

How to convert Octal and Hexadecimal to Binary?

Credito-The Credit Doctor

Quick Overview of C Programming

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

More from Medium

Zoe C, Assignment 2

Journey of DLithe Bootcamp .NET Full Stack Developer | Week 4 (Feb14-Feb19)

Coroutines In Kotlin

Camera-Ready Version Instructions for NIPS, ICML, AISTATS