C Identifiers

An identifier is a name created by the programmer. Examples include variable names, function names, array names and structure names.

Valid identifiers

  • studentName
  • total_marks
  • _count
  • marks1
  • calculateTotal

Invalid identifiers

  • 2marks – starts with a digit
  • student name – contains a space
  • total-marks – contains hyphen
  • int – keyword

Program example

#include <stdio.h>

int main() {
int studentAge = 21;
float totalMarks = 456.5f;

printf(“Age = %d\n”, studentAge);
printf(“Marks = %.2f\n”, totalMarks);

return 0;
}

 

OUTPUT
Age = 21
Marks = 456.50

 

⭐ EASY TIP: Use meaningful names. studentAge is much easier to understand than x.
Scroll to Top