Data Types - List of all format specifier in C-Programming | EDUshark



Data Types & Corresponding Format Specifier:--

The complete list for format specifier for all the data types is given as:
Variable with initialization
#include <stdio.h>
main()
{
  int a,b;
  Int c=34;
  a=5;
  b=10;
  printf (“ Using variable\n”);
printf (“ a=%d \t b=%d \t c=%d ”,a, b, c);
}

Output:

Using variables
a = 5             b = 10           c = 34

Explanation: For printing char type values we use %c.

Printing of char type variable ver

#include <stdio.h>
main()
{
Char ch;
Ch=’A’;
printf (“ ch=%d\n”,ch);
}
Output:

Ch=65

 Explanation: Each character has got its ASCII code is of 7 bits so there are total 128 ASCII codes. If we use %d format specifier for printing a char value we will get its ASCII equivalent in the output.

The ASCII values for digits, alphabets are as:

Character symbols

ASCII value

Lower case alphabets a-z

97 to 122

Upper case alphabets A-Z

65 to 90

Digits

48 to 57


We’ve listed the ASCII values only for the alphabets and digits. If you want to know ASCII value of any other symbol you can write the program and find out yourself what is the ASCII value of that symbol.

Features to main functions:

(i)                  Declared by C compiler, defined by user.

(ii)                Only one main function in a C program.

(iii)               Default return type int is assumed.

(iv)              Takes argument.

(v)                First function to be called when program executes.

 

         "I hope we served you best"


Comments