[C] Variable Declaration

Variable Declaration

#include <stdio.h>

int main(void)
{  
    int i; // Variable Declaration
    int i = 5 // Declare variable and initialization

    int i, j; // Declare multiple variables
    int i = 5, j = 10; // Declare multiple variables and initialization
    return 0;
}

Variable naming rules

  • Separate upper and lower case letters.
    • “int abc” and “int Abc” is different.
  • Variable names usually start with lowercase letters.
    • int tempCount
  • Only $ and _ can be used as Special symbols.
    • int _number
  • Can’t start with numbers.
    • int 1number(X), int number1(O)

Tags:

Categories:

Updated: