What is C Programming

What is C Programming

What is C Programming ?

C is a Computer Programming language, used to develop Operating Systems, Database, Language Compilers, Interpreters, Network Drivers and more Utilities. C is not a special-purpose but it is a general-purpose, procedural, structured, and High Level Language (HLL). C has now become a widely used professional language.

UNIX Operating System, Linux Operating System, My SQL Database have been written in C Language.

Who decide to became a developer in future, must learn C Language. C is easy to learn, and easy to understand. C is a basic of all type of programming Language. If any one learn the C Language, no more difficulties to learn newer or any other programming languages. You can also say C is a God of Programming language world.

Who Developed C?

C was originally developed by Dennis M. Ritchie to develop the UNIX operating system at AT & T Bell Labs USA. C was originally first implemented on the DEC PDP-11 computer in 1972.

How to Learn C Language ?

Like English Language, we can also learn C language in some easy steps-

Learning Steps for English Language

English Language Learning Steps

Learning Steps for C language

C Language Learning Steps

Now we start C Programming Language

In the Step 1 - we already known about alphabets, numbers and symbols. Then we have to go ahead Step 2 -

In this step, there are three points- Keyword, Variables and Constant. Now we discuss in detail about these topic one by one

What is Keywords?

This topic understand such as. think.. in the house, kitchen is reserved for cooking food, you cannot used the kitchen for any other work like bathing. In the C programming languaguge some words are reserved for a special type of work, each word has some meaning and work, and these work and its meaning are understand by C compiler/interpreter/computer.

Now, we can define this, keyword is a reserved word, we are used it when required. Computer already known about these keyword. C has 32 keywords. such as.. int, float, printf, scanf, getch, getchar, getche,..etc.

Almost all the keywords are used in small letter and proper way and place. You can not used in wrong way. It display error.

What is Variables?

You are already known about this type of expression in Algebra like-

a2+2ab+b2

In the above express, what called a and b?
obiviously a Variable. Vari + able is Variable. vari means change. Such a entity which values are changeable at each step is called variable

here .. 
a=5;
a=a+2;
now a is 7 
so a is variable.

Above definition and example of variable is very suitable in algebra mathematics, also in C Programming Language. But also a special property of keywords in C are introduced here.. see...

All the computer software are used to store and manipulate the value or information. These values are stored in computer memory. Here some questions are arises in mind-

  1. How the value or information are saved in the memory?
  2. In which location of memory are contain the value?
  3. And How will we called these value or information when require?

Answer of all Questions is - Variable

Variable is a way to store value or information. Variable is a identifier of memory location that hold a constant value or information.

Variable structure in memory

When we use ..

a=5;

it means 'a' is a memory identifier or name or label of memory where 5 is stored. And when we have required to called this value we use 'a'

What is Constants?

Constant is a value or user information that stored in memory. There are many types of values stored by user. These types of value is called data-types.

Types of Constants

There are three basic types of constants are mostly used in C Programming Language.

  1. Integer Constant
  2. Real Constant
  3. Character Constant

What is Integer Constant?

When program required a number without any decimal point to store in memory or calculation. e.g. 5, 10, 32, etc. These numbers are in integer category.

What is Real Constant?

When program required a number with decimal point to store in memory or calculation. e.g. 5.2, 10.023, 32.50, etc. These numbers are in Real or Floating point category.

What is Character Constant?

When program required a value like user name , address and other this type of value to store in memory. e.g. "Amit Kumar", 'M', 'F', 'Y', 'N', "New Delhi", etc. These types of values are in Character or String category.

String constants are written in double quotes(" ") and character constant s written in single quotes(' ').

Data types in C Programming Language

Types of variable defined for specific type of constant is called data type.

int is used to declare a variable to store a integer number. So it is called integer data type. int, long, short is integer types of data type

float is used to declare a variable to store a real number. So it is called float data type. float, double is float or real types of data type

char is used to declare a variable to store a character or String value. So it is called character data type. char is character types of data type

How to declare a Variable

Syntax:

datatype [variable_name];

Example :  
 int a; 
 float b; 
 char c; 
 char name[15];

Rules for taking Variable Name :

  1. Variable name must be a letter/alphabet or a word. Space not allowed in variable name.
  2. Variable name must be start with a character not a number
  3. Variable name cannot contains any special character like- @, #, $, %, ^, &, etc. only underscore (_) is allowed.
  4. Variable name cannot be a same name of any keyword (reserved word). like- int, float, printf, void, main, getch, etc.

A Sample Program of C Language

#include "stdio.h"			//Header file
void main()					//Main Program
{							//Main Program Start here
	printf("My Name is Bhagwan Babu");	//Output statement
}									//Main program Closed here

After written this program in turboc editor and save. Press Ctrl+F9 for Compile & Run

Now you feel your window a bit of time flicked but result not displayed. At this time use Alt+F5 to display result

Your output display in display window like as-

My Name is Bhagwan Babu.

Describe of the above Sample Program

#include "stdio.h"

This is the way of include of header file in our program.
Here #include is called a Preprocessor Directive, It tells to the compiler that include the given file in the following program before compilation of the code.

stdio.h here stdio is a header file where .h is a extension. stdio is also called as Standard Input Output

Header File is a file that contains some keywords definition. If you use any keyword / keywords in your program, You must include the corresponding header file/files in that program first. Header always included at the first position of the program.

void main() paranthesis () is the symbol of function, so main is a function, and void is return type of the function. void means NULL. so that we can say main is function which returns a NULL value. Overall main is such a function where compiler start from the execution of program and end to the execution, in C , C++ and Java

curly bracket { } is a start and close the main function. all the code will be written inside this curly bracket block.

printf("My Name is Bhagwan Babu");

In this statement printf is print function that display a message that are written in double quotes ("") as it is, on the display window. only such character which is written after backslash '\', e.g. \n, \t, \b, etc. and such like. %d, %f, etc. are not display on the display window. %d, %f, %lf are used to display the value to variable and \n, \t, \b are used to formatting of result on the display window.

0 comment(s)

Leave a Comment