C Function Type 1 Example | No Arguments and No Return Type


Our Blogs

function-Type.webp

Example of function Type 1 Categories function with no arguments no return type

C Language

Publish Date: April, 26-2019

Functions are an essential part of C programming that help make programs modular and reusable. In this example, we demonstrate a Type 1 function — a function with no arguments and no return type. Such functions do not take input parameters or return any value to the calling function. All operations are performed inside the function itself.

The following program defines a simple sum() function that takes two numbers as input and displays their sum. It uses Turbo C/C++ features like clrscr() and getch() for screen handling.


C Program: Function with No Arguments and No Return Type

#include <stdio.h>
#include <conio.h> // Used for clrscr() and getch() in Turbo C/C++

// 1. Function Declaration (Prototype)
void sum(void);

int main() {
    // clrscr(); // Clears screen in Turbo C/C++
    printf("--- Main Program Starts ---\n");

    // Function Call
    sum();

    printf("\n--- Main Program Ends ---\n");
    // getch(); // Holds screen in Turbo C/C++
    return 0;
}

// 2. Function Definition
void sum(void) {
    int a, b, c;

    printf("Enter the first number (a): ");
    scanf("%d", &a);
    printf("Enter the second number (b): ");
    scanf("%d", &b);

    c = a + b;
    printf("The sum (a + b) is: %d", c);
}


Explanation

  1. Function Declaration:
    void sum(void); tells the compiler that the function sum exists and takes no parameters.

  2. Function Call:
    In main(), the function sum() is called. The control jumps to the sum() function.

  3. Function Definition:
    Inside the function, variables a, b, and c are declared. The program takes input for a and b, adds them, and displays the result.

  4. Turbo C/C++ Functions:

    • clrscr() clears the output screen.

    • getch() holds the screen until a key is pressed.

This is one of the simplest examples of function type 1 (no arguments, no return type) in C.

Recent Post :-

Business-Setup.webp

Google My Business Setup Services in Raipur

Grow your business

Publish Date: April, 26-2026

youtube-marketing-agency.webp

Grow Your Business with YouTube Marketing in Raipur

YouTube Marketing Services

Publish Date: April, 24-2026

Website-Plans.webp

Affordable Website Plans in Raipur Today

Web Development Services

Publish Date: April, 22-2026

DigitalIndia_11zon.webp

Top Digital Growth Trends in Raipur for 2026 by Paramwebinfo

Digital Marketing

Publish Date: April, 20-2026

InternshipVsTraining_11zon.webp

Internship vs Training What is Better for Students

Internship

Publish Date: April, 18-2026

Branding vs marketing_11zon.webp

Branding vs Marketing What Works Best in Raipur

Branding Tips

Publish Date: April, 14-2026

Web-hosting-offer_11zon.webp

Best Web Hosting Offer in Raipur at Rs 3200 Year

Offers

Publish Date: April, 12-2026

DMS-for-business growth_11zon.webp

Grow Your Business with Digital Marketing Services in Raipur

Digital Marketing Services

Publish Date: April, 09-2026