Interview Question


Country: United States




Comment hidden because of low score. Click to expand.
1
of 1 vote

A pointer is a datatype, which stores the memory address of any datatype. The size of the pointer depends on the architecture of the system - a 32-bit system would have a pointer size of 32 bits to accommodate a memory address space of 4GB, a 64-bit architecture should use 64 bits for pointer data type. An array of pointers is an array of such address-holding datatypes.

Whereas a pointer to an array points to the (typically first) address of an array of locations which store a particular datatype, say ints, chars, etc, including pointers.

- Murali Mohan July 30, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

array of pointers : int *p[] ( This is a 2D array )
pointer to array : int *p=a (here 'a' is an array of integers)

- Anonymous July 30, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

int a[10];
int *p;
p=&a;//array of pointer
int *q[5];// pointer array

- murugesan August 01, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Array of pointers means we make an array which will store pointers ( i.e. address of data)
Pointer to an array means we have a pointer that gives address of 1st position of an array.

- LEENA August 10, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

char *p[]; //array of pointers
char (*p)[]; //pointer to an array of char
Array of pointers means that in this array we can store pointers (in this case char, which means it gives us freedom to store strings of variable lengths in a single array)

- Abhishek Sharma August 13, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

An array of pointers is an array, where the elements are pointers to some memory location.
for eg-
it would be something like
int* parr[10];
here parr[0],parr[1],etc are pointer variables


A pointer to an array is when a pointer is pointing to the starting address of an array.
eg, let int arr[10] be an array. A pointer that points to arr[0], would be a pointer to an array

- srinivas October 31, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

array of pointers means array contains the pointer values;
pointer to array means pointer pointing the arryay of elements;

- santhosh reddy September 25, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int a[3]={2,4,5},*p;
p=a; here p is pointer to array ..
int *p1[3]={p,p+1,p+2}; here p1 is array of pointer...

- mithilesh kumar (tict kolkata) November 07, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int a[3]={2,4,5},*p;
p=a; here p is pointer to array ..
int *p1[3]={p,p+1,p+2}; here p1 is array of pointer...

- mithilesh kumar (tict kolkata) November 07, 2014 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More