Sunday 6 September 2015

Data types in C

There are different data types those are:

1 Integer
2 Character
3 Float

the above three data types are more important to use in c programming  

Integer:

we use size of the integer is 2 Byte and %d is data type in c standard function. the range of the integer is  -32768 to 32767.


  • An integer constant must have at least one digit.
  • It must not have a decimal point.
  • It can be either positive or negative.
  • If no sign precedes an integer constant it is assumed to be
  • positive.
  • No commas or blanks are allowed within an integer constant.
  • The allowable range for integer constants is -32768 to 32767.
Character:

 Size of the character is 1 Bytes and %c is data types use in c standard function. 


A character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. Both the inverted commas should point to the left. For example, ’A’ is a valid character constant whereas ‘A’ is not.
The maximum length of a character constant can be 1 character.
Ex.: 'A'
'I'
'5'
'='

Float:

Real constants are often called Floating Point constants. The real constants could be written in two forms—Fractional form and Exponential form. Following rules must be observed while constructing real constants expressed in fractional form:

  • A real constant must have at least one digit.
  • It must have a decimal point.
  • It could be either positive or negative.
  • Default sign is positive.
  • No commas or blanks are allowed within a real constant.
Ex.: +325.34
426.0
-32.76
-48.5792


Introduction on C Programming

What is C?

C is a programming language developed at AT & T’s Bell Laboratories of USA in 1972. It was designed and written by a man named Dennis Ritchie. In the late seventies C began to replace the more familiar languages of that time like PL/I, ALGOL, etc. No one pushed C. It wasn’t made the ‘official’ Bell Labs language. Thus, without any advertisement C’s reputation spread and its pool of users grew. Ritchie seems to have been rather surprised that so many programmers preferred C to older languages like FORTRAN or PL/I, or the newer ones like Pascal and APL. But, that's what happened. Possibly why C seems so popular is because it is reliable, simple and easy to use. Moreover, in an industry where newer languages, tools and technologies emerge and vanish day in and day out, a language that has survived for more than 3 decades has to be really good.