C – Programming Elements

Program Elements: Program is a set of instructions.Every Program consists,

  • Identity
  • Variables
  • Functions
  • Identity:
    • Identity of a program is unique.
    • Programs, Classes, Variables and Methods having identities
    • Identities are used to access these members.
  • Variable:
    • Variable is an identity given to memory location.
    • Variable is also Called “Named Memory Location”
    • Variables are used to store information of program(class/object)
SyntaxExamples
    datatype identity = value;int age = 23;
double salary = 35000.00;
char gender = ‘M’;
char* name = “Amar”;  
  • Function:
    • Function is a block of instructions with an identity
    • Function performs operations on data(variables)
    • Function takes input data, perform operations on data and returns results.
SyntaxExample
returntype identity(arguments)         
{      
body;         
}  
int add(int a, int b)          
{      
int c = a+b;      
return c;          
}  
Scroll to Top