Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING HTML & CSS BASH RUST TOOLS

C Tutorial

C HOME C Intro C Get Started C Syntax C Output C Comments C Variables C Data Types C Type Conversion C Constants C Operators C Booleans C If...Else C Switch C While Loop C For Loop C Break/Continue C Arrays C Strings C User Input C Memory Address C Pointers

C Functions

C Functions C Function Parameters C Pass By Reference C Scope C Function Declaration C Functions Challenge C Math Functions C Inline Functions C Recursion C Function Pointers

C Files

C Create Files C Write To Files C Read Files

C Structures

C Structures C Structs Challenge C Nested Structures C Arrays of Structs C Structs & Pointers C Unions C typedef C Struct Padding

C Enums

C Enums

C Memory

C Memory Management C Allocate Memory C Access Memory C Reallocate Memory C Deallocate Memory C Structs and Memory C Memory Example C Memory Mistakes

C Errors

C Errors C Error Challenge C Debugging C NULL C Error Handling C Input Validation

C Problem Solving

C Problem Solving C Build the Logic C Edge Cases & Errors C Test Cases

C More

C Date C Random Numbers C Macros C Organize Code C Storage Classes C Bitwise Operators C Fixed-width Integers C Command-Line Args

C DSA

C DSA Intro C Searching C Sorting C Stacks C Queues C Linked Lists C Trees C Hash Tables C Big O

C Projects

C Projects

C Cert

C Certificate

C Reference

C Reference C Keywords C <stdio.h> C <stdlib.h> C <string.h> C <math.h> C <ctype.h> C <time.h>

C Examples

C Examples C Real-Life Examples C Exercises C Quiz C Code Challenges C Practice Problems C Compiler C Syllabus C Study Plan C Interview Q&A

C Keywords


Share

C Keywords

A list of all C keywords can be found in the table below.

Keyword Description
auto Declares a local variable that is created when its block starts and removed when it ends. This is the default for local variables, so the keyword is rarely used
break Breaks out of a loop or a switch block
case Marks a block of code in switch statements
char A data type that can store a single character
const Defines a variable or parameter as a constant (unchangeable)
continue Continues to the next iteration of a loop
default Specifies the default block of code in a switch statement
do Used together with while to create a do/while loop
double A data type that is usually 64 bits long which can store fractional numbers
else Used in conditional statements
enum Declares an enumerated type
extern Declares a variable or function that is defined in another file
float A data type that is usually 32 bits long which can store fractional numbers
for Creates a for loop
goto Jumps to a line of code specified by a label
if Makes a conditional statement
inline Suggests to the compiler that the code of a function should be inserted where the function is called
int A data type that is usually 32 bits long which can store whole numbers
long Ensures that an integer is at least 32 bits long (use long long to ensure 64 bits)
register Suggests that a variable should be stored in a CPU register for faster access. You cannot get the memory address of a register variable
restrict Tells the compiler that a pointer is the only way to access the data it points to
return Used to return a value from a function
short Reduces the size of an integer to 16 bits
signed Specifies that an int or char can represent both positive and negative values (for int this is the default so the keyword is not usually necessary)
sizeof An operator that returns the amount of memory occupied by a variable or data type
static Specifies that a variable in a function keeps its value after the function ends
struct Defines a structure
switch Selects one of many code blocks to be executed
typedef Defines a custom data type
union Defines a union, a type where all members share the same memory
unsigned Specifies that an int or char should only represent positive values which allows for storing numbers up to twice as large
void Indicates a function that does not return a value or specifies a pointer to a data with an unspecified type
volatile Tells the compiler that a variable can change at any time, for example by hardware, so it must always read the value from memory
while Creates a while loop
_Alignas Specifies the alignment (the memory address boundary) of a variable
_Alignof Returns the alignment of a type, in bytes
_Atomic Makes a variable atomic, so many threads can use it safely at the same time
_Bool A data type that can only store 1 (true) or 0 (false). Include <stdbool.h> to write it as bool
_Complex Declares a complex number type (a number with a real and an imaginary part)
_Generic Selects an expression based on the type of a value
_Imaginary Declares an imaginary number type (not supported by most compilers)
_Noreturn Specifies that a function never returns, for example because it ends the program
_Static_assert Checks a condition when the program is compiled, and stops with an error message if it is false
_Thread_local Specifies that each thread has its own copy of a variable

Note: The table lists the keywords in C11. C23 added a few more, like bool, true, false and nullptr.




Free account

Track your progress

XP earned 0 Day streak 0 Spaces 0 League —

New

Learn in Adventure Mode W3Schools Adventure App

Coding fundamentals as bite-sized lessons and challenges.

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.