TRICKS OF C LANGUAGE

Tricks of C language
1.     ‘ \t ’ :- It will leave 7 or 8 spaces (Tab)
Example:
   printf(“ Tricks of \t C language”);
Output: Trics of                  C language

2.     ‘ \r ‘ :- return the whole line
Example:
 printf(“ This is \r”);
 printf(“ C language”);
Output: C language
3.     ‘ \r\n ‘ :- same as \n
Example:
   printf(“ This is \r\n C languge”);
 Output: This is
                   C language

4.     ‘ \a ‘ :- this will give a beep
Example:
 printf(“ \a”);
Output: (it will a beep sound)
5.     To print
                        “ hey i’m learning c language”

printf(“\ “ Hey i’m learning c\””);

6.     int a=5.5;
printf(“a = %d”, a);
Output a=0
7.     char ch=’A’;
printf(“ch = %d”, ch);
Output: ch=65
8.     ASCII values
Digits (0 – 9) : 48 to 57
A – Z : 65 to 90 ( capital letters)
 a – z :  97 to 122 ( small letters)
·        To print value of double type use “ %f “ as a formate specifier.
Example :
double a=5.557;    
printf(“ double = %f ”, a);
Output: double = 5.557

·        The range of unsigned char is 0 to 255. If you store a number that is outside this range, the number is divided by 256 and remainder is stored in the variable.

·        Range of signed char is -128 to 127. If we store a number that is 1 more than 127 i.e. 128, the number stored will be -128, for 129 it will be -127 and so on. If you store -129 output will be 127.

·        The range of all data types ( int, char, float, double with qualifiers i.e. signed, unsigned) is stored in header file < limits.h>.

·        For to get remainder use “ % “ operator.

·        In order to print % on the output screen use % twice.

Example:
printf(“ C language is 100%% good language”);



Comments

Popular posts from this blog

Screen Saver Development In C language

Installing MySQL(5.7) on MacOS (Monterey)