BASICS OF C




  •  HEADER FILES:- In C, header files contain the set of predefined standard library functions. The "#include"                      preprocessing directive is used to include  the header files with ".h" extension in the program.
    • stdio.h :- Input/Output function
    • conio.h :- Console Input/Output functions
    • stdlib.h:- General utility functions
    • math.h :- Mathematical functions
    • string.h :- String functions
    • time.h :- Date and time functions
    • limits.h :- size of basic types


  • DATA TYPES:-



  • RULES FOR CONSTRUCTING VARIABLE AND CHARACTER CONSTANT:-
Rules for constructing CHARACTER CONSTANT:-

  • 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. 
  • The maximum length of a character constant can be 1 character. Ex: 'A' , 'I' , '5' , '='.
Rules for constructing VARIABLE NAMES:-
      In C language, any user defined variable name is called identifier. This may be variable names, function names, goto label name, any other data type like structure, union,enum names or typedef name.
  • A variable name is any combination of 1 to 31 alphabets, digits or underscores. Some compilers allow variable names up to 247 characters. 
  • The first character in the variable name must be an alphabet or underscore.
  • No special symbol other than an underscore (as in gross_sal) can be used in a variable name. Ex:- rate, time, si_int, m_hra, bas_sal, etc.
  • Keywords should not be used as variable names because  if we do so, we are trying to assign a new meaning to the keyword, which is not allowed by the computer.


  • DELIMITERS:-     
    •  :    Colon  :- Useful for label
    •  ;    Semicolon :- Terminates the statement
    •  ( )  Parentheses :- Used in expression and function
    •  [ ]  Square Bracket :- Used for array declaration
    •  { }  Curly Brace :- Scope of the statement
    •   #   Hash :- Preprocessor directive
    •    ,   Comma :- Variable separator


  • OPERATORS:-
    • Arithmetic Operator:- +,-,*,/,%
    • Unary Operator:- ++,--,&
    • Relational Operator:- >,<,>=,<=,==,!=
    • Logical Operator:- &&,||,!
    • Assignment Operator:- =
    • Conditional Operator:- ?:
    • Bitwise Operator:- >>,<<,&,|,^,~


  • DECISION STATEMENT:-
    • If-else statement
    • Nested if-else statement 
    • Break Statement
    • Continue Statement
    • Goto Statement
    • Switch() statement
    • Nested switch() case
    • Switch case() and Nested if

Post a Comment

0 Comments