Today is my Day.

July 2018

Data types :-


*      Data types refers to which types of value to be stored into the variable.
*      There are mainly two types of data types are available in c. language.

   1. Primary Data types / Built-in Data types
   2. User Defined Data types / Derived Data types



   1. Integer Datatype :-


*      We can use integer datatypes to store numeric values.
*      C. language supports integer datatypes in both signed and unsigned.
*      Integer datatpes has three types as short int, int and long int.

Types Size (Bytes) Range
short int or signed short int 1 -128 to 127
int or signed int 2 -32768 to 32767
long int or signed long int 4 -2,147,483,648 to 2,147,483,647
unsigned short int 1 0 to 255
unsigned int 2 0 to 65535
unsigned long int 4 0 to 4,294,967,295

   2. Floating point Datatype :-


*      Floating point datatypes can be used to store numeric values with decimal point.
*      There are threen floating types available in c. language.

Types Size (Bytes) Range
float 4 3.4e-38 to 3.4e+38
double 8 1.7e-308 to 1.7e+308
long double 10 3.4e-4932 to 3.4e+4332

   3. Charater Datatype :-


*      Character datatype can be used to store a single character value.

Types Size (Bytes) Range
char. or signed char. 1 -128 to 127
unsigned char. 1 0 to 255

   4. Void Datatype :-


*      The void datatype has no values. The type of function does not returned any value at that time we can use void type.

Datatype Format specifier
int %d
character %c
float %f
double %ld
long double %LD

Character Set :-

*    The character in c language that can be used in the c program. There are for types of character set available in c language.

 Character Set of c language

 Character Set          

       Symbol

Letters Upper Case -> A to Z
Lower Case -> a to z
Digit , Comma
. Dot
; Semicolon
: Colon
? Question Mark
' Single Quote
" Double Quote
! Exclamation
| Pipe
/ Forward Slash or Slash
\ Back Slash
~ Tiled
_ Under Score
$ Dollar
% Percentage
& Ampersand
^ Caret
* Asterisk
- Minus
+ Plus
< Opening Angular Bracket
> Closing Angular Bracket
( Left Parenthesis
) Right Parenthesis
[ Left Square Bracket
] Right Square Bracket
{ Left Brace or Left Curly Bracket
} Right Brace or Right Curly Bracket
# Hash
White Space Blank Space
Horizontal Tab
Carriage Return
New Line
Form Feed

Best Structure of "C" Program in c language


Structure of "C" Program

Document Section

Link Section

Definition Section

Global Declaration Section

Main() Section

{
   Declaration Part
}
   Executable Part

Sub Program Section


   Function 1() --
   Function 2()    |
   .................        |--> UDF
   .................        |
   Function n() --


(1) Documentation Section :-


*    The documentation section consist of a set of comment lines in the c program, comments, are the user defined message that are not compiled by compiler.
*    The example of comments the name of program , date, etc. *    There are type types of comments are available in c language.

Single line comment :-

*    We can specify a single line comment by using //symbol.
Ex :-      //This is single line comment

Multi line comment :-

*    We can specify a multi line comment by using /*.......*/.
Ex :-      /* This is multi line commnet
                 Developer Bhautik Jivani
                 Date :- 03-Jul-2018   */

(2) Link Section :-


*    This section provides the instructions to the compiler to link function from the system library.
*    This section includes the header files are stored in the c library. These header files contains the different library functions of c language.
*    The header files must be included in the c program.

Ex :-     #include<stdio.h> (Standard Input Output)
             #include<conio.h> (Console Input Output)

(3) Definition Section :-


*    This section contains all the symbolic constants. Constants means the fixed value for defining a contsant value. We can use # Define Statement.

e.g. :-     #define PI 3.14
*    Here variable PI has fixed value that is 3.14. That does not change during the execution of the program.

(4) Global Declaration Section :-


*    There are some user defined functions and variables are define globally that is in more than one function.
*    Such variables are known as global variables and they are declaredin the global declaration section.

(5) Main() Section :-


*    The c language must have one main function.
*    The main function is a special function used by c language to tell the computer where the program starts.
*    This section contains two parts:

Declaration Part :-

*    It declares the variables that can be used in the executable part.

Executable Part :-

*    It executes the statements. There is at least one executable statement. That main function starts with { & ends with }.

(6) Sub program/Function :-

*    This section contains all the user defined functions. That are called in the main function.


//This is first e.g. to print Bhautik


#include<stdio.h>
#include<conio.h>
void main()
{
    clrscr();
    printf("Bhautik");
    getch();
}

Contact Form

Name

Email *

Message *

Copyright © 2017 Jivani Bhautik.All rights reserved. Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget