C C++ Java Fundamental OS

C index

C Introduction
First C Program
Printf and Scanf function
Variable In C
Datatype in C
Operator in C

C Programming Language

C is a general purpose procedure oriented structured based middle level programming language.
It is developed by Dennis Ritchie in 1972 AT & T Bell Lab In USA. Using C programming easily creating (developed) Software (applications,drivers).
C Supports 32 Keywords, keywords is a Reserve word of C Program Compiler.

C programming is considered as the base for other programming languages, that is why it is known as mother language. It can be defined by the following ways:

1. C is Mother language
2. System programming language
3. Procedure-oriented programming language
4. Structured programming language
5. Middle-level programming language

Note:- C program extension name is ( .c ), it means c program save like first.c.

Editor name In C programming

(It is space where we can write a program)
List of C program Editor
Turboc
Turboc++(we can use This editor)
Dev C
Micro Soft visual C++
Unix

How to install turboc++ C program Editor

Download the TurboC++ from the internet
Double click on setup
Complete the setup process then Finish

How to Open TurboC++

Step 1:- Open this PC
Step 2:- Open C: (drive)
Step 3:- Open TurboC++ Folder
Step 4:- Open DOXBox

First C Program Coding

#include <stdio.h>
#include <conio.h>
void main()
{
printf("Hlw C Programming\n");
printf("\n Free net study \n \n elearning")
getch();
}
OUTPUT:-Hlw C Programmin
free net study

elearning
 

First C Program Snapshot


Note:- \n it is used to break the new line in the current program line.

Input Output Statement in " C "

Output Statement
* printf
* puts
Input Statement
* scanf
* gets
* getch

What is printf:-

It is a library function it is use to print the data on the output screen. It is use under header file of #include <stdio.h>.

What is puts:-

it is a library function it print the data on output screen in string format.

What is scanf:-

It is a library function it accept (input, Enter) data in compile time . it is used under header file of #include <stdio.h>.

What is gets:-

It accept data in run time,it only accept (input) string type format.

What is getch:-

It accept only one character in Run time the program.

Use of Hearder File in C program:-

Using this hearder file easly use the below mention keywords

#include <stdio.h>
* printf
* scanf
* puts
* gets
#include <conio.h>
* clrscr();
* getch();
#include <string.h>
* strlen
* strrev
* strlwr
* strupr
* strcpy
* strcmp
#include <graphics.h>
* textcolor
* setcolor
#include <stdbil.h>
* exit();
#include <dos.h>
* delay

What is Variable in C ?

C variable is a named location in a memory where a program can manipulate the data and can cantain a values, This location is used to hold the value of the variable.
How to Define Variable in Program
Syntax:- int num=10;
*variable must be start alphabet
*variable not start number
*variable not use keywords

C TOKEN

In C program, Each and every smallest individual units are known as C tokens.C tokens are the basic buildings blocks in C language which are constructed together to write a C program.
There are six types of Token,they are
Keywords (eg: int, while),
Identifiers (eg: main, total),
Constants (eg: 10, 20),
Strings (eg: “total”, “hello”),
Special symbols (eg: (), {}),
Operators (eg: +, /,-,*)

KEYWORDS IN C LANGUAGE:

C Supports 32 Keywords, keywords is a Reserve word of C Program Compiler.
Keywords are pre-defined words in a C compiler.
Each and Every keyword is perform a specific function in a C program.

int
double
auto
struct
const
float
short
unsigned
break
long
switch
else
for
continue
void
signed
char
case
enum
register
typedef
default
sizeof
goto
volatile
extern
return
union
do
if
static
while

What is Datatype in C ?

C Data types are used to define a variable before to use in a program.Data types are defined as the data storage format that a variable can store a data to perform a specific operation.

Format Specifier
Datatype
Size
Range
%d or %i
int
2 Byte
–32,767 to 32,767
%c
char
1 byte
–128 to 127
%f
float
4 Byte
3.4e-38 to 3.4e+38 with six digits of precision
%lf
long double
10 byte
3.4E-4932 TO 1.1E+4932 with ten digits of precision
%s
string
(No of character) * 1 byte
0 to 255
%u
Unsigned int
4 byte
0 to 4,294,967,295
%lf
double
8 byte
2.3E-308 to 1.7E+308

Operator in C

Operator Names
Symboles
Examples
Arithmetical Operator
+ , - , * , / , %
a+b
Relational Operator
< , > , <= , >= , == , !=
a > b
Logical Operators
&& , || , !
a && b , a || b, a!=0
Assignment Operators
= ,+= ,-= , *= , /= , %=
a=10 , a += b or a=a+b
Increment and Decrement
++ and --
a++ and a--
Bitwise Operators
& , | , << , >> , ^ , ~

Constant in C

Constants is a fixed values that the program may not alter (change) during its execution time. These fixed values are also called literals.The basic constants data types like an integer constant, a floating constant, a character constant and string literal. There are enumeration constants as well.

C Examples

First C program
second C program
Sum two number
Sum three number
Radius of Circle
(a+b)sqr
Check Negative Nu.
Check Greater Number

Previos Next