Saturday, 19 May 2012

input and output in c language

Computer is a machine which need some input as these input it gives some output to us.
Example : We have bike. We fill patrol in it as input as result  it run. similarly we need some input in computer programming . As  input it process and produce some output.

study previous blog

In c language we  use in built functions for input and output.

Input : Input is a process through which we assign values to variable. For taking input
we use scanf() function of c library. It's task to store data in memory that can be use for any purpose in programming.

Pattern   
                     scanf("%x",&variablename);
                      %x ---------> %c  for  character
                      %x ---------> %d  for  Integer
                      %x ---------> %f   for  float
here & is address of operator which gives address of any variable.

 

Output : Output is a process through which we print value of any variable. for taking output we use printf() function of c library. It's task to print value on computer screen.

Pattern
      
                      printf("%x", variablename);
                      %x ---------> %c  for  character
                      %x ---------> %d  for  Integer
                      %x ---------> %f   for   float
using printf() function we can print both value and address of any variable in c language.


Read latest blog

No comments:

Post a Comment