Constants in C.

  1. Decimal
  2. Octal
  3. Hexadecimal
  4. Real constants

Write a program that swap two values.

#include< stdio.h>
#include< conio.h>
void main()
int a,b,c;
printf("\nthe first number is %d",a);
printf("\nthe first number is %d",b);

Working with constants.

A constant is a value that can never be changed throughout the entire program in C program. A constant can be declared by the following two ways.

  1. Using const keyword -:Syntax-: const int a=6;
    Here, a becomes a constant of integer type having value 6, any change in this value will never be permitted.
  2. Using #define method -: This kind of constant is symbolic constant. Syntax -:
    #define  a 6

Escape sequences

Escape sequences are specific codes that modify the output of simple printf function

Some Commonly used Escape Sequences are as follows.
  1. \n -: New line
  2. \t -: Tab distance
  3. \a -: Audible beep

Control strings

Control strings are special codes used in printf statement especially for identifying the type of variable which is going to be displayed.
Following are the major control strings -:

%ld-:long integer
%u-:unsigned integer
%lf-:long float(double)
%Lf-:long double

Comments in C

  1. Single line
  2. Double line(multi line)

Single line Comment-:

void main()

Multi line comment-:

void main()

Types of errors in C

  1. Logical error -: These error arise due to a logical mistke however these error is not notified.
  2. Syntatical errors -: When we make a mistake related to grammar of C these errors are called syntatical errors.
  3. Run time errors -: These errors arise due to an exception or mathematical contratication.
  4. Linker errors -: When function and keywords fail to relate with their header files these error are called linker errors.