C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers


10,705 users

What are the advantages of using pointers in C?

0 votes
asked Jan 8, 2014 by keem Expert (13,240 points)

1 Answer

0 votes
Pointers are special variables which store address of some other variables.

Syntax: datatype *ptr;

Here * indicates that ptr is a pointer variable which represents value stored at a particular address.

Example: int *p;

'p' is a pointer variable pointing to address location where an integer type is stored.


1. Pointers allow us to pass values to functions using call by reference. This is useful when large

sized arrays are passed as arguments to functions. A function can return more than one value by using call by reference.

2. Dynamic allocation of memory is possible with the help of pointers.

3. We can resize data structures. For instance, if an array's memory is fixed, it cannot be resized.

But in case of an array whose memory is created out of malloc can be resized.

4. Pointers point to physical memory and allow quicker access to data.
answered Jan 8, 2014 by rajesh Guru (39,140 points)

Related questions

0 votes
1 answer 393 views
0 votes
1 answer 102 views
102 views asked Jun 17, 2011 by carlton Sr Member (3,990 points)
0 votes
1 answer 18 views
0 votes
1 answer 17 views
17 views asked Dec 28, 2013 by smith Geek (15,340 points)
0 votes
1 answer 22 views