Developer community
0 votes
asked by Expert (13.2k points) 27 43 61 | 97 views

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 by Guru (39.1k points) 10 22 36

Related questions

0 votes
1 answer
0 votes
1 answer
asked by carlton Sr Member (4k points) 5 11 21 | 108 views
0 votes
1 answer
0 votes
1 answer
asked by smith Geek (15.3k points) 17 43 67 | 21 views
0 votes
1 answer
asked by sunny Expert (11.4k points) 14 23 30 | 29 views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true


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

3.8k questions

4k answers


10.7k users

3,754 questions
4,046 answers
10,709 users