C Programming - Pointers - Discussion
Discussion Forum : Pointers - General Questions (Q.No. 7)
7.
A pointer is
Discussion:
33 comments Page 1 of 4.
Ramya said:
9 years ago
Can anyone tell me pointer is a variable or operator?
(1)
Mukesh Kr Siddhwan said:
10 years ago
Pointer is a specific type of variable that can be used to store the address of other variable. It is always denoted by '*' operator.
Some Features of pointer:
1. Pointer save the memory space.
2. Execution time with pointer is faster because data is manipulated with the address. i.e., direct access to memory location.
Pointer declaration:
Data type *pointer name;.
For example:
void main()
int a=100;
int *p;
p=&a;
In above example 'a' is the integer type of variable and 100 ia the value of that variable. *p is the pointer name. Suppose 4066 is the address of variable 'a'.
In above example p=&a;-in this code pointer p can be use to store the address of variable 'a', means the value of pointer p is 4066 (that is the address of variable 'a').
Some Features of pointer:
1. Pointer save the memory space.
2. Execution time with pointer is faster because data is manipulated with the address. i.e., direct access to memory location.
Pointer declaration:
Data type *pointer name;.
For example:
void main()
int a=100;
int *p;
p=&a;
In above example 'a' is the integer type of variable and 100 ia the value of that variable. *p is the pointer name. Suppose 4066 is the address of variable 'a'.
In above example p=&a;-in this code pointer p can be use to store the address of variable 'a', means the value of pointer p is 4066 (that is the address of variable 'a').
(1)
Vijaykumar gattu said:
1 decade ago
It stores the address of the variable how?
Mclean said:
1 decade ago
A pointer is simply a variable which holds the address of another variable there on can use it to access a variable by pointing to it.
Hina said:
1 decade ago
Pointer is Variable Which Stores the adrress of Other variable.
Reza said:
1 decade ago
Definition:
int *p;
*p = 10;
Explanation:
p is a variable with the type of pointer that stores the address of an anonymous variable with the type of integer (here is its value equals 10).
int *p;
*p = 10;
Explanation:
p is a variable with the type of pointer that stores the address of an anonymous variable with the type of integer (here is its value equals 10).
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?
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?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers