C programming language is the powerful programming language which follows the standards of ANSI ISO. C programming language is the base of the other programming language. Many other programming languages follow the standards of the C programming language. This language is mainly for developing the system applications that directly interact with devices such as drivers and kernels. C is also known as the procedural programming language because it solves the problem step by step. This cheat sheet covers all the basic concept of C programming language which is greatly helpful for the programmer. Whichever service is in high demand, you can get freelance services for the same.

printf() and scanf() Function

The C programming uses the printf() function for displaying the output whereas scanf() function is for taking the input from a user. In printf() function you use the different format specifier such as %d is used for displaying the integer value, %f for float variable, %c for display character, and %x for a hexadecimal variable.

Data Type in C programming language

You use the data type for defining the type of variable. Data Type defibes the size of the variable, constant and array. Following are the types of a data type:

  • Basic data type: It includes the int, float, char, and double
  • Enumeration data type: It includes enum
  • Derived data type: It includes union, pointer, array, and structure
  • Void data type: It includes the only void

Variables in C programming language

The name of the variable starts with the underscore and letter. The variable in C is case sensitive, and you create it with digits and letters. Following are the syntax for variable declaration and definition.

Variable Declaration

data_type  variable_name

Example: int a,b,c

Variable Initialization

data_type variable_name=value;

Example: int a=30, b=50;

Operators in C Programming Language

Operators are the set of symbols that tell the compiler to perform the particular action. The operators perform logical and arithmetic operations in the program. Post Freelance Jobs Online in which you are expertise.

Following are the types of the operators

  • Arithmetic Operators
  • Logical Operators
  • Relational Operators
  • Bitwise Operators
  • Conditional operators
  • Increment Operators
  • Special Operators.

Loop in C programming language

If you want to perform repetitive task in your program, then loop perform the important role in C programming language. Following are the types of the loop

  • for loop syntax

for(exp1,exp2,exp3)

{

Statements;

}

  • While loop Syntax

While (condition)

{

Statements;

}

  • do while loop Syntax

do

{

Statements;

} do(condition)

C Type Qualifier

To modify the properties of a variable C type qualifier plays an important role. There are two types of the type qualifier. Whichever service is in high demand, you can get freelance services for the same.

  • const

Once you define the value of the variable as constant, then value can’t be modified.

Syntax

const data_type variable_name;

(or)

const data_type *variable_name;

  • volatile

When you define any value of the variable as volatile, then the program may not change the value of the variable explicitly.

Syntax:

volatile data_type variable_name;

(or)

 

volatile data_type *variable_name;

Array in C Programming

The array is the collection of variables belonging to the similar type of data type. The array gets stored in the contiguous memory locations. The array in C programming language is of two types.

  • One Dimensional
  • Multi-Dimensional

Syntax:

Array Declaration Syntax:

data_type arr_name [arr_size];

Array Initialization Syntax:

data_type arr_name [arr_size]=(value1, value2, value3,….);

Array accessing syntax:

arr_name[index];

Pointers in C Programming Language:

The pointers are the variables that store the address of another variable, and they get used to allocate memory dynamically. The pointer variable belongs to the any of the data types such as int, float, char, and short.

Syntax for Pointer

data_type *var_name

Structure in C programming language

The structure is the collection of different data types grouped, and every element in C structure is called the member. Following are the syntax for structure

struct student

{

int a;

char b[10];

}

Union in C Programming:

The union is same as the structure where it is the collection of different data types grouped. The only difference is that it allocates the common memory. Post Freelance Jobs Online in which you are expertise. Following are the syntax for Union

Syntax Using Normal variable:

union tag_name

{

data type var_name1;

data type var_name2;

data type var_name3;

};

Syntax using the Pointer variable

Union tag_name

{

data type var_name1;

data type var_name2;

data type var_name3;

}

Summary:

This article is on the C programming language cheat sheet. This cheat sheet covers all the basic concept of C programming language which is greatly helpful for the programmer. As a programmer, you must know the basic syntax of the C programming language so that you can easily understand the other programming language.

Kitty Gupta