Saturday, 29 June 2013

C-datatype


escape sequence characters

  • escape sequences are used in formatting input and output
  • an escape sequences always begins with a backward slash and is followed character
  • c supports some special escape sequence characters that are used to do special task
  • these are also called as backslash characters
  • some of the escape sequence characters are as follows:


character constantmeaning
\nnew line
\bbackspace
\thorizontal tab
\fform feed
\aalert
\rcarriage return
\vverticaltab
\?question mark
\'single quote
\"double quote
\\backslash
\0Null

Monday, 24 June 2013

interger,floating point,character constants

interger constants:
integer constants take one of the following forms:
  • a decimal number e.g 1,123,100002.
  • an octal number e.g.,01,01273,0303242.anoctal constant is introduced by a leading 0 and the digits are 0 through 7
  • a hexadecimal number e.g.,0X1,0X7b,0X186A2.a hex constant is introduced by a leading 0Xor 0x and the digits are 0 trough 9 followed by a through F
  • a character constant
Floating point constants:
floating point constants take one of the following forms:
  • a decimal number followed by a decimal point followed by another decimal number e.g.,1.0,1.9993,3.42
  • a number like the previous but with an exponent part i.e  an e or E followed by a decimal number e.g 1.0e10,1.23e-2,1.00e+2
character constant:
  • A character constant is a character enclosed in single quotes e.g, 'a','2'
  • in a character constant a backslash character is treated specially it introduces an escape sequence
  • these escape sequences are usually used to represent characters that are not easy to see when represented by themselves or need to be escaped for syntax reason

CONSTANTS IN C


Sunday, 23 June 2013

syntax of variable

syntax:
                       

datatype v1,v2,v3.......
 

  • datatype refers to the type of the data i.e integer,float,character,double.....
  • v1,v2,v3...are the names of the variables variables are seperated by commas
  • a declaration statement end with semicolon
  • declaration of the variable is usually done immediately after the opening brace of the pgm
  • the variable can also be declared out side(either before or after) the main function


  

Saturday, 22 June 2013

variable


  • an identifier whose value is allowed to change during the creation of a program is called variable
  • every variable must be individually declared before it can appear in the program
  • the variable declaration establishes the fact the the identifier is a variable and  specifies the type of variable
rules for constructing variable:
  1. a variable name is any combination of 1 to 8 alphabets,digits,or underscores
  2. the first character in the variable name must be alphabet
  3. no commas or blanks are allowed within the variable name
  4. on special symbol other than an under score can be used in a variable name
  5. ex:si ine ,area,radius,marks1,sub marks

identifiers


                                              identifiers


  • identifiers are the names used for variables.types function and label in program
  • they must differ in spelling and case from the keywords
  • these are created by specifying it in the declaration of a variable type or function
rules for identifiers:
    1. first character must be alphabet
    2. must consists of only letters,digit,underscore
    3. only first 31 characters are significant
    4. cannot use a keyword
    5. must not contain white space