Variables and Functions Introduction in C

 

Variable:

  • Providing identities to standard memory locations.
  • Without identities, we cannot access the data once it has been stored.
  • Named memory location.
  • Using variables we can process the information effectively.
Variable Diagram

Variable Diagram

Method or Function :

  • A block of instructions having Identity.
  • Every method is taking input, processing input and returns output.
  • Every method must be called explicitly (using its identity).
Syntax of Function

Syntax of Function

  • Every method is having 2 main things.
  • Function definition (block of statements)
  • Function call (Single statement)
Function Definition and Call

Function Definition and Call

Why do we need to call a method explicitly?

  • Look at the example shown in the diagram.
  • Every electronic device (program) having much-inbuilt functionality.
  • But the functionality of any program will not execute automatically(TV will not be controlled itself)
Need of Function Call

Need of Function Call

Share this