Author: admin
-
Format Specifiers in C
Format specifiers in C are certain special symbols used in the formatted console IO functions such as printf() and scanf(), as well as formatted file IO functions such as fprintf() and fscanf(). Format specifiers are formed of a predefined sequence of one or more alphanumeric characters followed by the % symbol. For example, %d, %s, %f, %lf,…
-
Escape Sequence in C
An escape sequence in C is a literal made up of more than one character put inside single quotes. Normally, a character literal consists of only a single character inside single quotes. However, the escape sequence attaches a special meaning to the character that appears after a backslash character (\). The \ symbol causes the compiler to escape out of the string and provide meaning…
-
Literals
The term “literal” in computer programming terminology refers to a textual representation of a value to be assigned to a variable. In C, you can assign a value to a variable in two ways − The initialization of a variable in C is done as follows − On the other hand, an indirect initialization of…
-
Constants
A constant in C is a user-assigned name to a location in the memory, whose value cannot be modified once declared. This is in contrast to a variable in C, which is also a named memory location, however whose value may be changed during the course of the code. Instead of repeatedly using hard-coded values in a program, it is advised…
-
Booleans in C
Unlike the int, char or float types, the ANSI C standard doesn’t have a built-in or primary Boolean type. A Boolean or bool data generally refers to the one that can hold one of the two binary values: true or false (or yes/no, on/off, etc.). Even if the bool type is not available in C, you can implement the behaviour of Booleans…
-
Type Conversion in C
The C compiler attempts data type conversion, especially when dissimilar data types appear in an expression. There are certain times when the compiler does the conversion on its own (implicit type conversion) so that the data types are compatible with each other. On other occasions, the C compiler forcefully performs the conversion (explicit type conversion),…
-
Integer Promotions in C
The C compiler promotes certain data types to a higher rank for the sake of achieving consistency in the arithmetic operations of integers. In addition to the standard int data type, the C language lets you work with its subtypes such as char, short int, long int, etc. Each of these data types occupy a different amount of memory space. For…
-
Variables
A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable’s memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the…
-
Data Types
Data types in C refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted. In this chapter, we will learn about data types in C. A related concept is that of “variables”, which refer to the…
-
Basic Syntax
In C programming, the term “syntax” refers to the set of rules laid down for the programmer to write the source code of a certain application. While there is a specific syntax recommended for each of the keywords in C, certain general rules need to be followed while developing a program in C. A typical source…