Format Specifiers

Format specifiers are used to describe the format of input and output in formatted string. It is different for different data types. It always starts with %

The following is the list of some commonly used format specifiers in C:

Format Specifier

Description

%c

For b type.

%d

For signed integer type.

%f

For float type.

%lf

Double

%p

Pointer

%s

String

%u

Unsigned int

%%

Prints % character

C Cheat Sheet

This C Cheat Sheet provides an overview of both basic and advanced concepts of the C language. Whether you’re a beginner or an experienced programmer, this cheat sheet will help you revise and quickly go through the core principles of the C language.

In this Cheat Sheet, we will delve into the basics of the C language, exploring its fundamental concepts that lay the groundwork for programming. We will cover topics such as variables, data types, and operators, providing you with a solid understanding of the building blocks of C programming.

Similar Reads

Basic Syntax

Consider the below Hello World program:...

Variables

...

Data Types

A variable is the name given to the memory location that stores some data....

Identifiers

The data type is the type of data that a given variable can store. Different data types have different sizes. There are 3 types of data types in C:...

Keywords

Identifiers is the name given to the variables, functions, structure, etc. Identifiers should follow the following set of rules:...

Basic Input and Output

Keywords are the reserved words that have predefined meanings in the C compiler. They cannot be used as identifiers....

Format Specifiers

The basic input and output in C are done using two functions namely scanf() and print() respectively....

Escape Sequence

...

Operators

Format specifiers are used to describe the format of input and output in formatted string. It is different for different data types. It always starts with %...

Conditional Statements

Escape sequences are the characters that are used to represent those characters that cannot by represented normally. They start with ( \ ) backslash and can be used inside string literals....

Loops

Operators are the symbols that are used to perform some kind of operation. Operators can be classified based on the type of operation they perform....

Jump Statements

Conditional statements are used to execute some block of code based on whether the given condition is true. There are the following conditional statements in C:...

Example of Loops and Jump Statements

...

Arrays

Loops are the control statements that are used to repeat some block of code till the specified condition is false. There are 3 loops in C:...

Strings

Jump statements are used to override the normal control flow of the program. There are 3 jump statements in C:...

Pointers

C // C program to illustrate loops #include    // Driver code int main() {     int i = 0;        // for loop with continue     for (i = 1; i <= 10; i++) {         if (i == 5 || i == 7) {             continue;         }         printf("%d ", i);     }     printf("\n");        // while loop with break     i = 1;     while (i <= 10) {         if (i == 7) {             break;         }         printf("%d ", i++);     }     printf("\n");        // do_while loop     i = 1;     do {         printf("%d ", i++);     } while (i <= 10);     printf("\n");        // goto statement     i = 1; any_label:     printf("%d ", i++);     if (i <= 10) {         goto any_label;     }        return 0; }...

Functions

...

Structures

An array is a fixed-size homogeneous collection of items stored at a contiguous memory location. It can contain elements from type int, char, float, structure, etc. to even other arrays....

Union

...

Enumeration (enum)

Strings are the sequence of characters terminated by a ‘\0’ NULL character. It is stored as the array of characters in C....

File Handling

...

Preprocessor Directives

Pointers are the variables that store the address of another variable. They can point to any data type in C...

Common Library Functions

...

Conclusion

...