Explain the concept of array of pointers. 5m Jun 2010

By | August 11, 2016

Explain the concept of array of pointers. Using pointers write a program to test whether the given string is a palindrome or not. 10

 

ARRAY OF POINTERS

The way there can be an array of integers, or an array of float numbers, similarly, there can be array of pointers too. Since a pointer contains an address, an array of pointers would be a collection of addresses. For example, a multidimensional array can be expressed in terms of an array of pointers rather than a pointer to a group of contiguous arrays.

4 5 6

7 8 9

Two-dimensional array can be defined as a one-dimensional array of integer pointers

by writing:

int *arr[3];

rather than the conventional array definition,

int arr[3][5];

Similarly, an n-dimensional array can be defined as (n-1)-dimensional array of pointers by writing

data-type *arr[subscript 1] [subscript 2]…. [subscript n-1];

The subscript1, subscript2 indicate the maximum number of elements associated with each subscript.

 

palindrome

Solved program can be found on this link http://cssimplified.com/assignments/an-interactive-c-program-to-check-whether-the-given-string-is-a-palindrome-or-not-using-pointers

 

(c) Differentiate between

            (i)Various storage classes 6

Solved program can be found on this link http://cssimplified.com/c-programming/explain-various-types-of-storage-classes-in-c-with-example-for-each

 

(ii)Structure and union 4

Solved program can be found on this link http://cssimplified.com/c-programming/what-are-the-differences-between-structure-and-union-give-example-of-usage-of-the-union-8m-jun2008