C

C Programming

Master the fundamentals of C programming with comprehensive tutorials, examples, and hands-on exercises

Keywords and Identifiers in C

Keywords are reserved words in C that have special meanings and cannot be used as identifiers. Identifiers are names given to variables, functions, and other user-defined items.

C Keywords

C has 32 keywords that are reserved and cannot be used as variable names:

auto
break
case
char
const
continue
default
do
double
else
enum
extern
float
for
goto
if
int
long
register
return
short
signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while

Identifiers

Identifiers are names given to variables, functions, arrays, etc. They must follow these rules:

Must start with a letter (a-z, A-Z) or underscore (_)
Can contain letters, digits (0-9), and underscores
Case-sensitive (age and Age are different)
Cannot be a keyword
Cannot start with a digit

Examples

Valid and Invalid Identifiers
// Valid identifiers
int age;
float _salary;
char firstName;
int student1;

// Invalid identifiers
int 2age;        // starts with digit
float int;       // keyword used
char first-name; // hyphen not allowed

Explanation

  • Keywords: Reserved words with special meaning (e.g., int, return) that you cannot use as variable names.
  • Identifiers: Names for variables, functions, etc. Must start with a letter or underscore and are case-sensitive.
  • Naming conventions: Prefer descriptive names like totalCount over single letters for readability.
  • Common mistakes: Starting with digits, using hyphens, or accidentally using a keyword as a name.
Keywords
C keywords, identifiers, naming rules, reserved words, conventions
Quick Tips
  • Use consistent casing (camelCase or snake_case) across your codebase.
  • Avoid underscores at the start for public names; use descriptive names instead.
  • If you get a compiler error, check for misspelled identifiers or keywords used as names.

Frequently Asked Questions

C is a powerful, general-purpose programming language that's been around since the 1970s. It's the foundation for many modern languages and is essential for system programming, embedded systems, and understanding how computers work at a low level. Learning C gives you a solid foundation in programming fundamentals.

No prior programming experience is required! Our C programming tutorial is designed for complete beginners. We start with the basics and gradually progress to more advanced topics. However, having some basic computer literacy and logical thinking skills will be helpful.

You need a C compiler to run C programs. For beginners, we recommend using our online C compiler which requires no installation. For local development, you can use GCC (GNU Compiler Collection) which is available on Windows (via MinGW), macOS (via Xcode), and Linux. IDEs like Code::Blocks, Dev-C++, or Visual Studio Code are also helpful.

The time to learn C depends on your dedication and prior experience. With consistent practice (1-2 hours daily), you can grasp the basics in 2-4 weeks and become proficient in 2-3 months. Mastering advanced concepts like pointers, memory management, and data structures may take 6-12 months of regular practice.

C programming skills open doors to various career paths including system programming, embedded systems development, operating system development, device driver programming, game development, and firmware development. Many companies in automotive, aerospace, telecommunications, and IoT sectors actively seek C programmers.

Absolutely! C remains highly relevant and is consistently ranked among the top programming languages. It's essential for system programming, embedded systems, IoT devices, and performance-critical applications. Many modern languages are built on C, and understanding C helps you become a better programmer overall.