Example:
int **myfun (void)
{
int **myptr= calloc (sizeof (int *), 100);
return myptr;
}
Wiki User
∙ 2010-06-22 11:50:34line
No.
Array elements can be pointers, and pointers can point to array elements, if that's what you mean.
An array of pointers is that for eg if we have array of 10 int pointers ie int *a[10] then each element that which is stored in array are pointed by pointers. here we will have ten pointers. In pointer to an array for eg int(*a)[10] here all the elements that is all the ten elements are pointed by a single pointer.
I guess it is an 'array of pointers'. Example:int main (int argc, char *argv[])
There is no such thing as an "array to pointer." What you might be asking is "array of pointers." An array of pointers is just that, an array in which the variables are pointers. In C this would be an array of pointer variables that are each 4 bytes in size. It is declared like this: int *pointers[3]; A pointer to an array is a pointer that points to the whole array. For example, in C if you have int numbers[5][10]; int (*pointerToArray)[10] = numbers + 2; pointerToArray points to the third element of numbers, which is itself an array.
char* my_array[3]; /* an array of three pointers to char */
Typedef the function signature then create an array of pointers of that type. char* func1() {/*...*/} char* func2() {/*...*/} char* func3() {/*...*/} typedef char* (*func_ptr)(); func_ptr func_array[3]; int main() { func_array[0] = &func1; func_array[1] = &func2; func_array[2] = &func3; /*...*/ return 0; }
There is a difference: a pointer is a number that literally points to a place in memory. Arrays are groupings of a type. There is a close relationship between pointers and arrays, however: every expression with arrays (example: array[i]) can be expressed with pointers (example: *(array + i)), because for the computer, an array is just a list of pointers to the type of the array.
An array of pointers is a contiguous block of memory that contains pointers to other memory locations. They essentially allow non-contiguous memory locations to be treated as if they were an actual array.
Use the array to maintain pointers to each stack.
Arrays are implemented as pointers in c.