
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
What are the different categories of functions in C Programming?
Depending on whether arguments are present or not and whether a value is returned or not, functions are categorized into −
Functions without arguments and without return values
Functions without arguments and with return values
Functions with arguments and without return values
Functions with arguments and with return values
Functions without arguments and without return values
Example
#include<stdio.h> main (){ void sum (); clrscr (); sum (); getch (); } void sum (){ int a,b,c; printf("enter 2 numbers:
"); scanf ("%d%d", &a, &b); c = a+b; printf("sum = %d",c); }
Output
Enter 2 numbers: 3 5 Sum=8
Functions without arguments and with return values
Example
#include<stdio.h> main (){ int sum (); int c; c= sum (); printf(“sum = %d”,c); getch (); } int sum (){ int a,b,c; printf(“enter 2 numbers”); scanf (“%d%d”, &a, &b); c = a+b; return c; }
Output
Enter two numbers 10 20 30
Functions with arguments and without return values
Example
#include<stdio.h> main (){ void sum (int, int ); int a,b; printf("enter 2 numbers"); scanf("%d%d", &a,&b); sum (a,b); getch (); } void sum ( int a, int b){ int c; c= a+b; printf (“sum=%d”, c); }
Output
Enter two numbers 10 20 Sum=30
Functions with arguments and with return values
Example
#include<stdio.h> main (){ int sum ( int,int); int a,b,c; printf("enter 2 numbers"); scanf("%d%d", &a,&b); c= sum (a,b); printf ("sum=%d", c); getch (); } int sum ( int a, int b ){ int c; c= a+b; return c; }
Output
Enter two numbers 10 20 Sum=30
- Related Articles
- What are the different types of functions in C Programming?
- What are the different categories of classification?
- What are the different types of YouTube Video Categories?
- What are the scope rules to functions in C programming?
- Functions in C programming
- What are different ways of defining functions in JavaScript?
- What are the Different Functions of the Human Resources Department?
- What are the different benefits of using programming languages in compiler design?
- What are the applications of C++ programming?
- Explain the different categories of End Users in DBMS?
- What are the major parts of the brain? Mention the functions of different parts?
- What are the advantages of C++ Programming Language?
- What are the Three Categories of Risk Attitudes in Finance?
- Where are different receptors present in human body? What are their functions?
- What are the C library functions?

Advertisements