,

46. typedef

The C programming language provides a keyword called typedef, which you can use to give a type, a new name. Following is an example to define a term BYTE for one-byte numbers − typedef unsigned char BYTE;After this type definition,…
,

45. Bit Fields

Suppose your C program contains a number of TRUE/FALSE variables grouped in a structure called status, as follows −struct { unsigned int widthValidated; unsigned int heightValidated; } status;This structure requires 8 bytes…
,

44. Unions

A union is a special data type available in C that allows to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. Unions provide an efficient…
,

43. Strings

Strings are actually one-dimensional array of characters terminated by a null character '\0'. Thus a null-terminated string contains the characters that comprise the string followed by a null.The following declaration and initialization…
,

44. Structures

Arrays allow to define type of variables that can hold several data items of the same kind. Similarly structure is another user defined data type available in C that allows to combine data items of different kinds.Structures are used to…
,

42. Pointer : Return pointer from function

We have seen in the last chapter how C programming allows to return an array from a function. Similarly, C also allows to return a pointer from a function. To do so, you would have to declare a function returning a pointer as in the following…
,

41. Pointer : Passing pointer to function

C programming allows passing a pointer to a function. To do so, simply declare the function parameter as a pointer type.Following is a simple example where we pass an unsigned long pointer to a function and change the value inside the function…
,

40. Pointer to Pointer

A pointer to a pointer is a form of multiple indirection, or a chain of pointers. Normally, a pointer contains the address of a variable. When we define a pointer to a pointer, the first pointer contains the address of the second pointer, which…
,

39. Pointer : Array of pointers

Before we understand the concept of arrays of pointers, let us consider the following example, which uses an array of 3 integers −#include <stdio.h> const int MAX = 3; int main () {int var[] = {10, 100, 200}; …
,

38. Pointer : arithmetic

A pointer in c is an address, which is a numeric value. Therefore, you can perform arithmetic operations on a pointer just as you can on a numeric value. There are four arithmetic operators that can be used on pointers: ++, --, +, and -To…