Concept of programming C

PROGRAMMING OF C

Programming can be defined as solving and supplementary solution of a problem using any language.

  • The developer of program language used language for following reason:
  1. It make easy for help to solve a problem and using computer.
  2. It helps in proper instruction of source.
  • Types of programming language
  1. Low Level Language
  • It works an bits 0 and 1
  • It is hard to understand
  • It is fastest
  • Example: machine language
  1. Middle Level Language
  • It contain feature of low level and high level language.
  • It slower than machine language but faster than high level language.
  • It is used to write system programs.
  • Example : C language.
  1. High Level Language
  • It is easy to write program .
  • It is slower than low level and middle level language.
  • It is used to write the commercial software.
  • Example: Java

 

  • History of C language:- C language is created by two computer scientist.
  1. Dennis Mac Alistair Ritchie
  2. Brian Wilson Kernighan
  • It was created in 1972 at AT&T bell lab in USA
  • It is heavenly implanted by the language BCPL&B
  • It was implemented an UNIX operating system.
  • Features Of C Language:-
  • C Language support rich library function which can used by programmer to write their program.
  • C is machine independent programming language.
  • C is portable language (i.e) :- program written on one machine can be on other machine without modification.
  • C support pointer which allow programmer to access memory thus access to hardware.
  • C is case sensitive in nature.
  • Basic structure of C program:-  A C program may consist of one or more following section:-

# Include header file section global declaration section

Main()
{
Declaration part
Executable part
}
User defined function
{
}

As following structure:-

  • Header file section:- In this section programmer can include various header file as per his requirement each header file extension H.
  • Global declaration:- This section optical & it is used under certain conditions. This section used when we want to declare some various which are global.
  • Main function:- Every program written in C language must contain main function. Empty parentheses after may are necessary. The function main is started point of program. It is important because it helps system to decide execution starting point.
  • Declaration:- Declaration part contain all declaration of variable, constant, array etc. the compare reserve memory for all the declaration variable, constant etc. during execution of program this memory can be utilized later.
  • Executable part:- Executable part contain those statement which are used to display output and act as inter phase for used.
  • User defined function:- It is a optional section it is used only when we are using function in the program.
  • Component Of C Program:- 
  • Character Set:-  character set consist of alphabets or both upper case and lower case letters. C language is case sensitive because the C compiler. Are reorganizes the lower case letter different from upper case letter.
    character set
  • Data Type:- Data type indicates the type and nature of data to be stored in memory. Data type help a programmer to select the appropriate type as per need of application. There types of data types are :
  • Primary/Fundamental/Primitive Data Type
  • User Defined Data Type
  • Derived Data Type
     
  • Fundamental Data Type:- There are five type of fundamental data type. In C language integer. It is used to stored whole number it is represented by keyword(ind). The size of integer variable is either two one four bites system dependent.The range of integer data type is -32768 to +32767.
     
  • Float (floating point)- It is used to stored fractional and decimal number. It can be either (-) or (+) it is represented by keyword float. It can store the fractional number the range of integer -3.4E-3.8 to 3.4E+3.8.The size of float is 4 byte.
  • Double Data Type: The double data type can be used in case accuracy of floating point number is inadequate. It can be either (-) or(+) number it is represented keyword (double). It occupies 8 bite of memory the range is 1.7E – 308 to 1.7E+308.

  • Char:- It is used to character the compiler unique ASCII value to store character in the memory the keyword char the size or memory of char is 1 bite. The range -128 to +127.
     
  • Void Type:- Void means nothing in C language it is generally used an we don’t want a function to return a value. We prefers void a head of function name. example- (void main). It is also to store a generated quarter.
     

Variable/Identifier:- Variable is the name which is used to state a value. This value can change during execution of the program. A data type is associated with each variable. The data type of variable decide what type of value can be stored in a variable.

​​Rule for naming a variable/Identifier:-

  • The name of variable must start with a character.
  • The name of variable should not be the keyword in the language.
  •  Only underscore special character is allowed in the name.
  • C is a case sensitive language and upper case and lower case are treated differently.

Declaration of variable: It means telling the compiler about name of variable and data type of the variable. The compiler will reserve memory execution of the program.

Initialization Of The Variable: Its means assigning initial value to the variable declaring the variable.

Types of initialization:-

In C language a variable can be initialization into two ways.

  • Compile time initialization:- In this we initialize a variable during writing a program and value is assignment by compiler during compilation of program.example : int a = 5
    Float 2 = 7.5
  • Run time initialization.In this we initialize a variable during running the program and value is assigned by compile during execution of the program.

Keyword:- Keyword are those word which have predefined meaning assigned by the language. There are 32 keyword as per ANSIC. The32 keyword are as follows

  • Auto, break, case, char, const, continue, default, do, double, else, enum, float, for, go, to, if, int, long, register, short, signal, size off, static, struct, switch, type, def, union, unsigned, void, volatile, while.

Constant: It is the value that cannot be changed during the execution of the program.

Types of constant:-

  • Numeric constant:- Are those constant which constant of numeric digit. May or may not have fractional part.
    -It may or may not have + or – sign.

Rule for naming numeric constant:

  • Numeric constant should have at least 1 digit.
  • No, common or space between 1 digit.
  • It can be + or –ve sign but default sign will be +ve.
     
  • Character constant:- A character constant is a constant in which a character enclosed between single quotes.
     
  • String constant:- Are those constant in which a group of character is enclosed between double quarts.
    Example: Char X = “TA”
    Char X = Sanjay dutt

     
  • Symbolic constant:-It is used when we want to use a constant separate line then we can denote or define it using symbolic constant.
    # define constant name constant value. It is defined above void name in the program.
    EXAMPLE: We want to use value of pie 3.`445 in air program multi time for calculation. We can use t as symbolic constant.
    # define I 3.145 rather than using the value directly, we will replace the PIE symbol by its value.

Category: 

tags: 

Share

Who's new

  • ravirajpatil871...
  • shubhambajoria
  • yassir
  • demiholyman890954
  • scottgillum51169040

Get Notified

 

Share

We are Social

Syndicate

Subscribe to Syndicate