Best Answer
  • I take it you are using some version of c,c++,visualC etc etc. One thing that is standard is pointers. A pointer is the address of a memory space that holds information in that specific space. By referencing the pointer in your code, you can print out that specific bit of information that the poiner is actually pointing to. Hope this helps
User Avatar

Wiki User

โˆ™ 2011-01-13 06:35:56
This answer is:
User Avatar

Add your answer:

Earn +5 pts
Q: What is pointer to the array of function?
Write your answer...

Related Questions

How do you create a pointer to an array of function pointers?

You point at the array the same way you would with an array of any pointer type, by using an additional level of indirection than is employed by the pointers in the array itself. In this case, the array contains pointer-to-function data types (with one level of indirection), thus you must use a pointer-to-pointer-to-function data type (with two levels of indirection) in order to point at the array itself. Had the array contained pointer-to-pointer-to-function data types (where each pointer points to a separate array of pointer-to-function data types), then you'd use three levels of indirection, and so on. You increase the level of indirection by placing an additional asterisk before the pointer's name when you declare the pointer. That is, one asterisk per level.

How do you return an array from function?

By returning a pointer to the first element of the array.

What is the difference bw function pointer and function of pointer?

function pointer is a variable that hold the address of any function which declared in the program but function pointer is the array of the function that accept the run time size of the function.

What is pointer array?

an array of pointer

How you pass array elements to a function?

Passing array elements to a function is achieved by passing the individual elements by reference or by value, just as you would any other variable. However, passing the entire array requires that you pass a pointer-to-pointer to the array along with the dimension(s) of the array.

If an array is declared in user defined function and pointer to this array is returned to main function is it possible to access that array?

Either put some array terminator as the last element (like '\0') or return the length of the array as an output from user defined function.

Passing an array name to a pointer assigns the first memory location of the array to the pointer variable?

Yes, passing an array name to a pointer assigns the first memory location of the array to the pointer variable. An array name is the same as a pointer to the first location of the array, with the exception that an array name is a r-value, while a pointer is an l-value.

When you pass an array as an argument to a function what actually gets passed?

In C, all array names will implicitly convert to a memory address at the slightest provocation. Thus when we pass an array name to a function, the value we actually pass is the start address of the array. So in order for a function to accept an array, its formal argument must be a pointer variable of the appropriate type. The address we pass is then copy-assigned to this pointer when we invoke the function.

How do you declare the following An array of three pointers to chars An array of three char pointers A pointer to array of three chars A pointer to function which receives an int pointer?

Please ask just one question at a time!Question 1:How do you declare an array of three pointers to chars?How do you declare an array of three char pointers?Note: both of these questions are merely alternative wordings for the same question.Answer 1:char * a[3];Question 2:How do you declare a pointer to an array of three chars?Answer 2:char a[3]; // an array of three charschar * p = a; // a pointer to an array of three charsQuestion 3:How do you declare a pointer to a function which receives an int pointer?Answer 3:#include // some functions we can point at:void func_1(int * p){}void func_2(int * p){}// note: all functions we wish to point at with the same// pointer must have the same main(){int* p = NULL; // instantiate an int pointervoid (*pFunc) (int*); // declare a function pointerpFunc = func_1; // point to func_1pFunc(p); // call func_1 via function pointerpFunc = func_2; // point to func_2pFunc(p); // call func_2 via function pointerreturn(0);}Note that the brackets in the function pointer declaration are required. If you omit them, you will end up with a standard function declaration that returns a pointer to void, resulting in a compiler error.

Where is the memory allocated for the array declaration in 'C'?

It depends how the array is declared (fixed size or variable size) and where it is declared (global scope or local scope). If the array is declared in global scope (outside a function) and is fixed size, it will be allocated in static memory. If it is variable size, the pointer is stored in static memory while the array itself is allocated on the heap. The pointer in static memory points to the start address of the array in heap memory. If the array is declared in local scope (inside a function) and is fixed size, it will be allocated on the stack in whichever thread the function was called. If it is variable size, the local pointer is stored on the stack while the array is allocated on the heap. The pointer will fall from scope when the function returns so the array must not be allowed to outlive the function in which the pointer is declared. If the array must outlive the function that allocates the array, the pointer must be declared at a higher scope in the call stack and must be passed by reference to or returned by value from the function that allocates the array. If you provide your own memory manager, however, an array may be allocated wherever the memory manager's memory pool is allocated, be it in static memory, the stack or the heap. A memory manager essentially allocates an array of bytes which you can then utilise as you see fit (the array of bytes will be allocated as per the previous description for arrays in general).

Is passing an array to a function exactly the same as passing a pointer to the first element?

Yes it is

Can an array be accessed through a pointer?

yes.. an array can be accessed through pointer

What is the difference between array to pointer and pointer to an array?

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.

How do you pass values to array by using reference?

In C, arrays are always passed by reference. This is, if you have an array value, and you pass it as the argument to a function, you are actually passing a pointer to the first element in the array, and modifications to the array from inside the function will be seen by the caller.

What is the difference between pointer and array?

Pointer holds an address Array holds values

What is a pointer in the array?

A pointer into an array of elements of type E is a pointer to a single element of type E:typedef ..... E;E array[123];E* const pointer = &array[18]; // points to the 19th element inside 'array'An array of pointers is an array whose elements are pointers:typedef .... E;E* array[123];E** const pointer = &array[18]; // points to the 19th pointer within 'array'Referencing the name of the array variable without use of the index operator itself is a constant pointer to its first element. Therefore, the following if-clause is always true:typedef .... E;E array[123];if (array &array[N]) { // ALWAYS true ...}

What happen when a c program passes an array as a function argument?

When an array name is passed as a function argument, the address of the first element is passed to the function. In a way, this is implicit call by reference. The receiving function can treat that address as a pointer, or as an array name, and it can manipulate the actual calling argument if desired.

Why cannot arrays be passed by values to functions?

When a array is passed to a function, the array is internally changed to a 'pointer'. And pointers are always passed by reference. Hence the answer to the question.

Why you use an array of pointer to pointer?

because u freakin can

How do you declare A pointer to array of three chars?

char c[3]; //array of 3 chars char * p; //pointer of type char p=c; //point the pointer to the base of char array

What is the use of pointer?

To point with. 1. To manipulate parts of an array. 2. To return more than value from a function.

Which two pointer does not increment or decrement in arithmetic array?

constant pointer and character pointer

Why can't we increment an array like a pointer?

once we initialize the array variable, the pointer points base address only & it's fixed and constant pointer

Why should a function that accepts an array as an argument and processes that array also accept an argument specifying the array?

Basically in c++ passing an array as an argument only provides a pointer to the first value and that function won't know how many values it has.If you read beyond the size you will just get garbage from memory.

What is a pointer to pointers?

A pointer is a variable like any other. As such, it has memory allocated to it. It is similar to an int in that they both store a value in their memory location. However, whereas an int value is interpreted as a whole number, a pointer's value is interpreted as a memory address. The pointer is said to "point to" the memory address it contains. The type of the pointer determines the type of the variable stored at that memory address. the following is a declaration of a pointer to an integer initialised with the value zero: int * p = new int(0); A pointer to a pointer is no different to an ordinary pointer, except the memory address it points to is that of another pointer. The following is an example of a pointer that points to the pointer we've just declared. int ** pp = p; Pointer-to-pointer variables are typically used whenever you need to pass a pointer by reference. All pointers are passed by value, so the memory address they contain is passed, not the pointer variable itself. To pass the pointer itself, you must pass a pointer to the pointer, which passes the memory address of the pointer. This then makes it possible to change the memory address stored in that pointer. Pointer-to-pointer variables are also used when declaring dynamic, multi-dimensional arrays. For instance, a 2-dimensional array requires a pointer-to-pointer to reference the array itself. This pointer points to a 1-dimensional array of pointers, each of which points to a 1-dimensional array of the actual variables in the array. Unlike a static multi-dimensional array, where the entire array occupies contiguous memory, a dynamic multi-dimensional array may not reside in contiguous memory. Pointer-to-pointer can be extended further to accommodate 3-dimensional arrays, and above. A 3D array requires a pointer-to-pointer-to-pointer, which points to a 1-dimensional array of pointer-to-pointer, each of which references a 2D array, as previously outlined.