My FeedDiscussionsHashnode Enterprise
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

What is C Programming? Introduction, Basics, Advantages, Disadvantages

Dheeraj Patidar's photo
Dheeraj Patidar
·Jul 18, 2022·

4 min read

Do you want to learn Programming Languages?

Are you excited to know about programming logics & stuff?

Today we are going to discuss about the core programming language called "C Programming".

As we all know that C programming is the starting of programming world. All high level languages (like Python, Java, etc.) are inspired from C programming.

Most of the experienced programmers has suggested to learn Programming logics through C Programming because it is easy to understand.

Now the first question arises is What is C Programming?

Introduction to C Programming

C is a programming language developed at Bell telephone laboratories in 1972 by Dennis Ritchie. It is one of the oldest and finest programming language. C programming language is reliable simple and easy to use structured programming language.

Major parts of popular operating system like windows, Unix, Linux, etc are written in C. It is the most appropriate language for learning computer programming.

Some Important Facts about C

  • C is invented to Write Linux operating system.
  • C is a successor of B language which was introduced around 1970.
  • C was formalized in 1988 by the American National standard Institute (ANSI).
  • Today's most popular Linux OS and RDBMS MySQL have been written in C
  • C was originally first implemented on the DEC PDP-11 computer in 1972.

Why to use or learn C Programming?

we learn or use C Programming Because of Some Features and Advantages of C :-

  • Easy to learn
  • Structured language
  • It produces efficient programs
  • It can handle low-level activities
  • It can be compiled on a variety of computer platforms

Basics of C Programming

When we talk about the basics of C programming, three main terms are important which are Variables, Constants, & Keywords. There are not basic of C programming for interview but are the fundamentals or base of C Programming.

Let's talk about these three terms one by one:

Variables, Constants, & Keywords in C

Variables

Variables are the storage place where we can store n number of Values. We can store Data in computer through Variables.

To store any value in computer we need to help variables. Through variables we can easily Store values in computer and also accessing them easily.

C Variables are also called "Identifiers", used to store data in computer memory for mathematical operations and manipulations.

Ex.=> a=2, b='a', c=2.5

Rules for Declaring or Naming Variables in C programming :-

  • The first character must be an alphabet or underscore(_).
  • No commas, blanks allow.
  • No special symbol other than underscore is allowed.
  • Variable names are case sensitive

Constant

In C programming, an entity whose value doesn’t change is called a constant. If we change value of constant during execution of program then we get Compilation error.

Constants are the values which are storaged in Computer thought Variables. Means variables holds constant values in them.

Types of constant: Primarily there are 3 types of constant :-

  • Integer constant = -1,6,7,9
  • Real constant = -322.1,2.5,7.0
  • Character constant = ‘a’,’$’,’@’(must be enclosed within single inverted commas)

Keywords

keywords are predefined reserved words in a programming language. these keywords help us to use the functionality of C programming.

Due to their special meaning we cannot be used them for other purpose.

There are 32 keywords available in C programming: auto double int struct break else long switch case enum register typedef char extern return union const for short void continue float signed while default goto sizeof volatile do if static unsigned

we will discuss about each of the C programming keyword in detail in another post.

Basic Structure or Syntax of a C Program

All c programs have to follow a basic structure. A c program starts with the mainf functionand executes instructions presents inside it. Each instruction terminated with a semicolon(;).

There are some basic rules which are applicable to all the c programs :-

  • Every program's execution starts from the main function.
  • All the statements are terminated with a semi-colon.
  • Instructions are case sensitive.
  • Instructions are executed in the same order in which they are written.
  • For printing output of any C Program we Need to use predefined function of stdio.h header file Called printf( ).
  • For taking input there is one more predefined function of stdio.h header file is used called scanf().

Flow of C Program in computer

Step 1: C program (source code) is sent to preprocessor first. The preprocessor generates an expanded source code. Step 2: Expanded source code is sent to compiler which compiles the code and converts it into assembly code.

Step 3: The assembly code is sent to assembler which assembles the code and converts it into object code. (.o or .obj).

Step 4: The object code is sent to linker which links it to the library such as header files. Then it is converted into executable code. (.exe)

Step 5: The executable code is sent to loader which loads it into memory and then it is executed. After execution, output is sent to console.

Advantages of C programming