List Headline Image
Updated by Santosh Sahu on Aug 26, 2020
 REPORT
Santosh Sahu Santosh Sahu
Owner
9 items   1 followers   9 votes   5 views

C Tutorial

C is a procedural and general-purpose programming language created by Dennis Ritchie in 1972 at the Bell Telephone Laboratories. It was invented to write UNIX operating system. C is the most widely used computer language. The main features of C language include low-level access to memory, easy to learn and modular structure which makes code debugging, maintenance, and testing easier. Due to these features make C language suitable for system programmings like an operating system or compiler development.

Source: https://www.alphacodingskills.com/c/c-tutorial.php

The format specifiers helps the compiler to understand the data types and formats in the input or output stream. It is used with scanf() function while taking input and printf() function while printing the output. Here is the list of format specifiers available C language:

Operators are used to perform operation on two operands. Operators in C can be categorized as follows:

  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Increment/Decrement operators
  • Logical operators
  • Bitwise operators

There are many instances in the programming, where a user need a data type which represents True and False values. For this, C has a bool data type, which takes either True or False values.

One of the most important parts of learning any programming language is to understand what are the available data types, and how data is stored, accessed and manipulated in that language. Based on the data type of a variable, the operating system allocates memory to the variable and decides what can be stored in the reserved memory.

In C language, a string is an array of characters terminated with a null character \0. When a compiler encounters a string without null character \0, it appends the null character \0 at the end by default.

Create a C-String

There are number of ways to declare a c-string. Please see the syntax below:

A loop statement allows a program to execute a statement(s) multiple times which provides easier and flexible programming. C has three loop statements.

The for loop executes a set of statements in each iteration. Whenever, number of iteration is known, for loop is preferred over while loop.

The Switch statement in C language is used to execute one of many code statements. It can be considered as group of If-else statements.

_switch (expression){
case 1:
statement 1;
break;
case 2:
statement 2;
break;
...
...
...
case N:
statement N;
break;
default:
default statement;
} _

Arrays are used to store multiple values in a single variable. In C, all elements of an array must be of same datatype.

Create an Array

It starts with defining the datatype of the array, name of the array followed by size of the array enclosed in square brackets, [ ].