header ad

C Programming Basics with Examples

 C is called a procedural programming language because it follows a specific process to develop the program. it was initially developed by Dennis Ritchie in 1972 at Bell laboratory. it was mainly developed to write an operating system. so it is also called a system programming language.

because it is a fast compile programming language. most of the programming languages like c++, java, javascript copy the syntax, and way of c programming. and the c++ is the almost second copy of c programming.


What we learn in this Tutorial.

  1. C programming Introduction.
  2. Basic concepts of c programming.
  3. Keywords in C programming.
  4. Simple c program.

After reading this tutorial you should have basic knowledge of c programming.

basic of c programming


before we get started with the c programming let's take a look at the Versions of c programming.

c programming versions

for the first time when the c was created in 1972. it was not c programming because it was a lower scale programming.


Basic Concepts of C programming.

Before you get started with c programming you should have at least basic knowledge of c programming.


#include

this syntax is used to include one source file or header file into the program or file.

<stdio.h>

It is a header file that defines the standard stream objects that input and output data.

printf

It is a function that is used to generate the output or print the message on the output screen.

scanf

It is a function that is used to scan the user inputs using the format specifiers.

argument

It is a piece of data that is passed into a function or program. it is also known as parameters and has two types of actual and formal parameters.

break

It is an inbuilt keyword that is used to exit from the loop and statements.

continue

It is an inbuilt keyword that is used to escape the lines of code or terminate the current iteration.

heap

It is a pool of memory that is used for the allocation of dynamic memory in the program.

exception

The error or code that occurs when the program is executing is called an exception.

int

It's a data type keyword that is used to allocate the integer values like 1 to 9 and it's combinations.

float

It's a data type keyword that is used to allocate the floating-point values like 1.2 or 1.01 etc.

char

It's a data type keyword that is used to allocate the character variable like a to z.

array

It's a data structure that is used to store the collection of the same type of values.

pointer

It is used to store the address of a variable or object.

sizeof()

It's a function that is used to find the size of an object or variable or it returns the length of the variable.

void

It is a keyword that is used to store the absence of value in a variable.

union

It is a user-defined data type that allows us to store different data types in the same memory location.

structure

It is a user-defined data type that groups related variables of different data types.


Keywords in c programming.

Keywords are the registered words that used to perform a specific task. we can't use any keyword for other work. c programming has 32 reserved keywords.


keywords in c programming


Basic C program with Explanation

c program with explanation

The first line #include <stdio.h> tells the compiler to include the contents of the inbuild library header file stdio.h in the program.

A header file usually containing the inbuilt functions, macros and to use these functions we need to include the relative library in the program.

The next line int main(void) is a function of the type name and the int keyword tells that this function return int value and inside the bracket that is (void) tells about the arguments that a function takes. and always remember that the c program always starts executing from the main function in the program. so a c program must always have a main() function in it.

Next { ------ } tells that from where the function starts and where the function end. { indicate the start point of function and } indicate the endpoint of function.

Next to the puts("Hello, World"); calls the puts() function to print the message on the output screen. and remember to use any function in the program we need to include the relevant header file in which the function declared.

Next return 0; means the function return the 0 value. remember when we start with int main(void) we see that the main function only returns the integer value so the 0 is an integer value and so it returns the 0.

Note: In c programming, every statement needs to end with ; semicolon. so we need to place ; after completing every statement as you see in the program.

Post a Comment

2 Comments

  1. राष्ट्रीय शिक्षा नीति 2020 के उद्देश्य
    2030 तक स्कूली शिक्षा में 100% जीईआर के साथ पूर्व-विद्यालय से माध्यमिक स्तर तक की शिक्षा के सार्वभौमिकरण का लक्ष्य कि प्राप्ति करना। राष्ट्रीय शिक्षा नीति 2020 के माध्यम से स्कूल से दूर रह रहे 2 करोड़ बच्चों को फिर से मुख्य धारा में शामिल किया जाएगा। Read more :- Shiksha Niti Blog

    ReplyDelete
  2. I want to learn full c programming language. Please, tell me the way of learning programming language

    ReplyDelete