Showing posts with label Format Specifiers. Show all posts
Showing posts with label Format Specifiers. Show all posts

Sunday, March 10, 2013

C format specifiers


Format Specifiers in C
%i or %d int
%c char
%f float
%lf double
%s string
%hi short
%ld long int
%d,%hu unsinged short
%u unsinged int


  • \n (newline)
  • \t (tab)
  • \v (vertical tab)
  • \f (new page)
  • \b (backspace)
  • \r (carriage return)

Format Specifier for int and short in C example

 /*  
  * FormatSpecifiers.c  
  * Copyright 2013 Afiz <afiz@afiz-Extensa-4620>  
  */  
 #include <stdio.h>  
 int main(int argc, char **argv)  
 {  
      int a =109990909;   
      short b = 23;  
      printf("%d,%hi\n",a,b);  
      return 0;  
 }