Loading, please wait...

A to Z Full Forms and Acronyms

First Program in C Programming

Aug 20, 2019 C programming, first c program, 2122 Views
In this article you can learn about Basic program of C

Basic Program:- Our first C Program

We are going to learn a simple “hello world” C program in this section. And some basics of a C program.

1) C basic program with output and explanation

2) Steps to write C programs and get the output

3) Creation, Compilation, and Execution of a C program

4) The basic structure of a C program

PROGRAM

#include<stdio.h>
int main()
{
/* our first simple c basic program */
printf(“hello world”);
getch();
return0;
}

output:-

hello world

 

                   Command

                                 Explanation

1) #include 

 This is the Processor command that includes standard input output header file (stdio.h) from the C library before compiling a C program.

2) int main()

 This is the main function from where the execution of any C program begins.

3) {

 This indicates the beginning of the main function.

4) /*some comments */

 Whatever is given inside the command in any C program won't be considered for compilation and execution.

5) printf("hello world")

 printf command prints the output onto the screen.

6) getch();

 This command is to wait for any character input from the keyboard.

7) return0;

 This command terminates C program (main function) and returns 0;

8) }

 This indicates the end of the main function.

                                                                                        

The explanation for the above C basis Program:

Let's see the section of the above simple C program line by line.

Steps to write C programs and get the output:

Below are the steps to be followed for any C program to create and get the output. This is common to all C program and there is no Exception whether its a very small C program or very large C program.

1) Create a program

2) Compile the program

3) Execute or Run the program

4) Get the output.

Creation, Compilation and execution of a C program:

Prerequisite:

  • If you want to create, compile and execute C programs on your own, you have to install a C compiler in your machine. Then, you can start to execute your own C programs in your machine.

  • You have to install a C compiler and compile and execute C programs in your machine.

  • Once C compiler is installed in your machine, you can create, compile and execute C programs.

A to Z Full Forms and Acronyms