C Programming - Pointers - Discussion

Discussion Forum : Pointers - General Questions (Q.No. 7)
7.
A pointer is
A keyword used to create variables
A variable that stores address of an instruction
A variable that stores address of other variable
All of the above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
33 comments Page 3 of 4.

Latha said:   1 decade ago
Can you please explain pointer is used to store address of that variable or address of another variable?

Sahil said:   1 decade ago
Can somebody please give some effective answer as to why option B is wrong Because a pointer can also store address of an instruction viz. Function pointer. So they why B is considered wrong ?

Jim said:   1 decade ago
Your answer is confusing because pointers can ALSO store things that are not variables.

A variable is something that has a type, value, and a symbolic name.

- Pointer to a string constant. char *p = "Hello";
Note that a string constant does not have a name. This is not a pointer to a variable.

- Pointer to dynamic memory. int *p = (int *) malloc(10);
Note that the memory dynamically allocated is mutable but it is not a variable because it has no name.

What about a pointer to a function?

Bhawana said:   1 decade ago
Can anybody tell why option B is not correct?

Mary gold said:   1 decade ago
Pointer is not a variable because variable is used to store the values but pointer is used to store the address of variable.

So pointer is a operator which is used to store the address of another variable.

Vijaykumar gattu said:   1 decade ago
It stores the address of the variable how?

Rishikesh Agrawani said:   1 decade ago
Hello friends, I just want to discuss few points about the pointer:

(1) A pointer is a variable of specific type, which is capable of holding the address of another variable of the same type.

(2) It is most powerful concept of c/c++, which allows us to manipulate the contents of memory by their addresses.

(3) You can sort the set of strings by using only single double pointer variable in your source program, try to do it, if you never tried. It will help you to have the good knowledge of pointer.

Juna sudev said:   1 decade ago
Dudes one doubt is arise to me. Pointer is one of the data type know? Then how will we tell option C is right?

Manmeet said:   1 decade ago
The correct definition of a pointer is:

Pointer is a variable that stores logical address of an another variable.

We should always specify what type of address we are talking about.

As there are two types of addresses that are:

1: Physical addresses.
2: Logical addresses.

Rishikesh Agrawani said:   10 years ago
A pointer is a variable of specific type, whose value is address of another variable of its type. The variable can be of any built-in type or any user defined type.

We should have the good knowledge of pointers as it provides a good way of handling dynamic data structures like linked list, stack, queue etc. We use indirection operator (*) in front of variable name for declaring pointer variable.

Eg: int *iptr; char *cptr;


Post your comments here:

Your comments will be displayed after verification.