codegurukool.com · Free coding tutorials & online compiler

Home › C Tutorial › C variables

C variables

Named storage for values.

Declare with a type: int age = 20;. Names use letters, digits and underscores and cannot start with a digit. Declare several at once: int a=1, b=2;.

Example code

#include <stdio.h>
int main() {
  int age = 20;
  float price = 9.99;
  char grade = 'B';
  printf("%d %.2f %c\n", age, price, grade);
  return 0;
}

Run this code in the online editor

← C commentsC data types →