C - Syntax ~ myTechpartner Join Me On Facebook
Join Me On Facebook

Blogroll

C - Syntax

Flying Bee

                                             WELCOME  TO THE  'C ' WORLD
‘C’ seems a strange name in programming language. But this strange sounding language is one of the most popular computer languages today because it is a structured, high-level, machine independent
language. It allows software developers to develop program without worrying about the hardware
platform where they will be implemented. C was evolved from ALGOL, BCPL and B by Dennis Ritchie at the bell laboratories in 1972. C uses many concepts form these languages and added the concept of data types and other powerful features. Since it was developed with the UNIX operating system, it is strongly associated with UNIX. Importance of C The increasing popularity of C is probably due to its many desirable qualities. It is robust language whose rich set of built in functions and operators can be used to write any complex program. The C compiler combines the capabilities of an assembly language with features of high level language and therefore it is well suited for writing both system software and business packages. Program written in C is are efficient and fast. This is due to variety of data structures and powerful operators. It is many times faster than BASIC. Another important feature of C is its ability to extents itself. A C program is basically a collection of functions that are supported by the c library. We can continuously add our own function C library. With the availability of a large number of functions, the programming task become simple.



DATA TYPES
Data type indicate the type of data that a variable can hold. The data may be numeric in nature
c provides a standard ,minimal set of data types. Some times these are called "primitive type". More complex 1data types can be build up from these basic types. All c compiles support five fundamental data types namely

integer(int),character(char),floating point(float),double-precision floating (double) and viod .Many of them

also offer extended data types such as long int and long double.

1)   int
          This is a keyword used to indicate an integer number any integer number is a sequence of digits

without a decimal point the range of int depends on the word length of the computer. Here word length means the

of bits that can be accessed(for reading or writing purpose) at time by the processor.
 If your computer is a16-bit computer then the range is given by
                      15                    15
                    -2   <=integer number<=2   -1
 
 
2)   float

     This is a keyword used to indicate a floating point number are same as real numbers,they are called

floating point of the shifting of the decimal point either to the left or to the right of some digits during

manipulation these numbers may be expressed either in decimal (fixed) form or scientific form the scientific

notation is also called mantisson-exponent notation.

3)    char
      This is a key word used it indicate the character type data. The data may be a character constant or

storing constant. a character constant can be defined as many single character within a pair of apostrophe's.
 

4)   double
       
     This is a keyword used to indicate a double precision floating point number .The precision is associated

with the accuracy of data
It is used whenever more accuracy is required in representing the floating point number.Normally, it is

equivalent to float,but the number of significant digits stored after the decimal point is double than that of

the float.


5)   void

      The void type has no values.This is usually used to specify the type of functions .The type of a

function is said to be void when it is does not return any value to the calling function .It can also play the

role of generic type ,meaning that it can represented any of other standard types.
 


    DATA TYPE MODIFIERS

     The basic data types excepts void can be modifies using  series of type modifiers to fit the recruitment of a particular program more closely. To here an accuracy for a real number, we are using double data type similarly, for integer data, the accuracy can be obtain by some data modifiers are also called qualifiers ,They are:

 1)Signed
 2)Unsigned
 3)Short
 4)long


 1)Signed

      This can be applied to integer variables.The default declaration assumes a signed number the signed

modifier can also be applied with char type ,to create a small integer .In  some implementations char is

unsigned meaning that it can held integers 0 to 255.If it is specified as signed then it can hold the numbers

in the range -128 to 127.                               

2) Unsigned
      
       This can be used for both int and char ,it can also be used in combination with long or short .It issued to create an unsigned integer.The high order bit of a signed integer is used as a signed flag.If the high order bit is zero ,then the integer is treated as positive and if the high order bit is one then the integer
is treated as negative.


3) long
 
       This is applied to int data type when applied to int ,if essentially doubles the length in bits of the data type that it modifies.If an int of 16-bits ,then long int is of 32 bits .Similarly this can be used with double .When long is applied to double, it roughly double the precision (the precision of a numerical data can defined as the number of significant digits that are used to measure or store the elements)

 4) short

       This makes the size of an int half but most compiles have 16-bit int and since ANSI requirements that the smallest acceptable size for int is 16-bit .Most of the systems provide size of a short and that of int.




                  Data Type
                     Size
     Range of value can store
  int
            2byte
        -32768 to 37767
  unsigned int
           2byte
        0 to 65535
  signed int
           2byte
       -32768 to 32767
  short int
           2byte
        -32768 to 32767
  long int
           4byte
-2147483648 to 2147483647
  unsigned long int
           4byte
 0 to 4294967295
  float
           4byte
 304E-38 to 3.4E +38
  double
           8byte
 107E -308 to 107E +308
  long double
           10bytes
 3.4E -4932 to 1.1E +4932
  char








* Simple structure of a c program.

   void main()
    {
      statement part
    }

 * Save our work as .c extension.

  *  %d - integer
  *  %f  -float
  *  %c -character

  *  printf  statement

      This is the statement used to display anything in the screen. 
      printf("            given here which you want display on the display.           ") ; 
   
      eg:  printf(" Hello World");
           output like this  Hello world
     

  

1 comment:

 

Contributors

Online Marketing

Do you Like this Article?

rss twitter facebook