writing out put data in C

Writing  out put data

    Out put data  can be  written  from  computer  memory to the standard  output  device (monitor) or to  another  file .C  provides  the  printf( ) library function  for  writing  output  data .with   this  function  all type  of  values(numeric character  or string) can be  written  as output .The  printf( ) function  moves  data  from  computer  m emory  to the standard  output  device ,,whereas  scanf() function  takes  the  input  data from  standard  input  device  and store   it to the  computer  memory. The printf function can be  written  as -

Print(“control  string  “, variable 1,variable2………) 


In this  function  the control  string  has  string (text) with coversion specification  character .It  should  be enclosed  with  double  quotes . the  variable  names  are optional  in the  printf() function  . the variable  name  should  not be  prceded  with ampersand(&).

 Some example  of  printf() function are as-



main( )


printf(“c is excellent”);



out put :

C is excellent


Here  control string  has only  text and no  conversion  specification character  ,hence  the  output  is only  text-


#include <stdio.h>

main( )


int basic ;



printf (“%d”,basic);


 in the  example  control  string  has  conversion  specification  character  %d which  implies  that  integer value  will be  displayed  and the  variable  name  basic  has that  integer- value  which  will  displayed  as output.


Ex- 3

#include  <stdio.h>

main( )


float  height ;



printf(“%f “,height);



here control  has  conversion specification character  % f which  means  that  floating  point  number  will be  displayed  and  the variable  name  height  has that floating  point value which will  be displayed  as output.


It will continue in next  blog




Print | posted on Friday, November 16, 2012 5:51 PM

Advertisements at BlogUnlimited.com


No comments posted yet.

Your comment:

Please add 6 and 3 and type the answer here:

Copyright © Afsana Bano

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski