C Programming Basics

| Last Updated: | In: C Programming Tutorial


C programming is an imperative procedural language. It was designed to compiled using a relatively straightforward compiler and it also provides the access to memory to provide language constructs to follow the machine instructions.

In this section, you will learn how to start with c programming and also I will explain this by using a simple and easy example program which prints the “Hello World”. Apart from this, you will also learn the below things:

  • Basic commands of c programming.
  • How to write a C program.
  • A simple C program with an output.
  • How to compile and execute a C program.

Basic commands of c programming

Below are the basic commands of C programming language:

#include : A command for the preprocessor to include the standard input output header file(stdio.h) from C library.ng a C program
int main(): Main function, from where execution of C program begins.

How to compile and execute a C program

Follow the below steps to compile and execute the C programs.

Step 1) Go to the path where you have saved your C programs.

Step 2) Assume you have saved your C programs in D drive, then run this command to compile your program D:\C Programs>tcc hello.c

Step 3) After execution of “tcc command”, just type the program name and hit the enter button.

D:\C Programs>hello
Hello

Simple Example:

Output:

Program to accept input from user

Below program will take input from the user using scanf and print while program execute.

Program output:

Enter an integer
50
Integer entered by you is 50

C programming books

Below is the list of recommended c programming books for the beginners.


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby.


You may also like:

Tags: , , , , , , , ,