Showing posts with label Functions. Show all posts
Showing posts with label Functions. Show all posts

Wednesday, 14 March 2012

Variable Declaration, Constant, String Constant, Character Constant, Numeric Constant, Functions


Variable Declarations:-

                   Every variable needs to be declared before it is used in a program. Variable declaration provides following info the  compiler:-

·        How many bytes in the memory should be allowed for that variable.
·        What type of operation can be done on that variable.
·        What range of value can a variable consist.
A variable declaration consists of a data type followed by one or more variable names, ending with a semicolon. Syntax-

Datatype  var1, var2-------varn;
Ex:- int a,b,c;

Constant:-
          Constant is a data intem that’s value can be changed during program execution. There are three types of constants-
  •             String Constant
  •            Character Constant
  •            Numeric Constant

    String Constant:-

          A string constant is a sequence of alphanumeric characters enclosed in double quotation marks. The maximum length of a string constant is limited to 255 characters.

    Character Constant:-

          Character constant is either a single alphabet or single digit, or a single special symbol enclosed within a pair of single quotation mark.

    Numeric Constant:-

          Numeric constant has a constant value in numbers. The value of the constant can be positive or negative numeral. There are four type of numeric constants:-

·        Integer Constant
·        Floating Point constant
·        Octal Constant
·        Hex constant

Functions:-

          A function is a sub program that contains instructions or statements to perform some specific work.