Showing posts with label C. Show all posts
Showing posts with label C. Show all posts

Tuesday, December 11, 2018

Introduction To C Programming : Dennis Ritchie and Ken Thompson

What is C :

C programming language is a standardized programming language which was developed by Dennis Ritchie and Ken Thompson in early 1970s at bells lab. It is one of the Best and most widely used programming languages It was designed to provide the access to low-level map and to require less runtime support.

  • C programming language is a standardized programming language which was developed by Dennis Ritchie and Ken Thompson in early 1970s at bells lab.
  • It is one of the Best and most widely used programming languages
  • It was designed to provide the access to low-level map and to require less runtime support.

Steps involved in C languages :

Alphabets , digits , special symbols >>> constants, variables ,  keywords >>> instructions >>>  program

The C character set:

Alphabets  -  A ,B,....X,Y,Z
                       a,b,c.....y,z.
Digits -  0,1,2,3,4,5,6,7,8,9
Special symbols -  !, @ ,# ,%, ().../?$

Constants variables and keywords :

  • A constant is an entity that does not change it is also called literals.
  • A variable is an entity that may change and also called identifiers.
  • A keyword is a special word In this language that carries special meaning.

Types of c constants:

  Now C constants can be easly divided into two major categories : 

  ( A) Primary constants :
                                      Integer constant ,  Real constant, Character
  (B) Secondary constants :
                                     Array, Pointer, Structure, Union, Enum



C keywords:

  • There are only 32 keywords a label in C.
  • The keywords cannot be used as variable names.
  
There are only 32 keywords a label in C. The keywords cannot be used as variable names.

Begin with the first C program -
1. #include<stdio.h>
2. int main (void)
3. {
4. printf("hints4you");
5. return 0;
6. }

Line 1: #include<stdio.h>
Preprocessor
                              The C preprocessor is a macro preprocessor that transforms the program before it is compiled. 

Their are Few of the common uses of C preprocessor are :
  • Include header files
  • Macros
  • Conditional compilation
Header file : 
 
Header file is a file which contains a function declaration and macro definition which is to be shared between various source file. 

It has two types:
  • The files which programmer writes.
  • The files which comes with compiler. 
Name                                 Description
<complex.h> :  A set of functions in this language for manipulating complex numbers 

<stype.h>  : Define state of functions used to classify characters by their types or to    convert between upper and lowercase in a way that is independent of the used character set. 

<errno.h> : For testing error codes in this language reported by library functions. 

<float.h> : Define macro constants find the implementation specific properties of the floating point library. 

<stdnoreturn.h> : For specifying non returning function .

<string.h>: Define string handling functions .

<tgmath.h>: Define type generic mathematical functions .

<threads.h>: Define functions for managing multiple Threads as well as mutexes and condition variables. 

<time.h> : Define date and time handling functions .

<uchar.h>: Types and functions for manipulating Unicode characters. 

<wctype.h>: Define state of functions used to classify white characters by their types or to convert between upper and lowercase. 

Line 2: int main(void )
  • It is the starting point from where the execution of the C program begins.
  • The execution begins with the main ()function.
Line 3 and 6: {}
  • Used to define a scope or function and control statements always starts and ends with curly brackets.
Line 4: printf("hints4you");
  • Printer is a predefined standard library function to print the given string i.e. "hints4you" on standard output.
Line 5: return 0;
  • The return statement returns the value from main () and 0 indicates the successful termination.

Data types:

  • In case of  C programming language data types are seriously declarations for memory locations or variables.
  • The C language provides the four basic arithmetic type specifiers char,int,float,double.
  • The modifiers signed, unsigned ,short and long. 
In case of  C programming language data types are seriously declarations for memory locations or variables. The C language provides the four basic arithmetic type specifiers char,int,float,double. The modifiers signed, unsigned ,short and long.

In case of  C programming language data types are seriously declarations for memory locations or variables. The C language provides the four basic arithmetic type specifiers char,int,float,double. The modifiers signed, unsigned ,short and long.