answersLogoWhite

0


Best Answer

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

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you return an array from function?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a c program to find the maximum of two numbers and print out with its position?

maxValue = function (array) {mxm = array[0];for (i=0; i<array.length; i++) {if (array[i]>mxm) {mxm = array[i];}}return mxm;}; i don't know


What is return type of string in c?

In C programming, a string doesn't have a specific return type as it's essentially an array of characters. So, if a function is returning a string, it should be declared to return a pointer to a char (char*), since a string in C is represented as an array of characters terminated by a null character ('\0').


What is the array function in CAD?

there r 2 types of array in cad - rectangular array and polar array...........


Is it possible for a function to return more than one value at a time?

No, you can only return one value with a return statement. However, you can return a structure or pointer, so the real answer is yes, though requiring some added complexity.


What is recursive call in terms of algorithm?

A recursive call in an algorithm is when a function (that implements this algorithm) calls itself. For example, Quicksort is a popular algorithm that is recursive. The recursive call is seen in the last line of the pseudocode, where the quicksort function calls itself. function quicksort('array') create empty lists 'less' and 'greater' if length('array') ≤ 1 return 'array' // an array of zero or one elements is already sorted select and remove a pivot value 'pivot' from 'array' for each 'x' in 'array' if 'x' ≤ 'pivot' then append 'x' to 'less' else append 'x' to 'greater' return concatenate(quicksort('less'), 'pivot', quicksort('greater'))

Related questions

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?

In this video, I Cover an array of essential methods for every developer. see these videos on YouTube:- Brain Mentors YouTube Channel.


Is it possibly to return an array of strings in a function without using pointers in C plus plus?

No.


Write a function in java that accepts an array of integers and returns the second largest integer in the array Return -1 if there is no second largest?

Method 1: Sort the array in descending order, compare 1st and 2nd if not same , return 2nd if same return -1 Method 2: Find the largest number in the array, initialize another array with dimension 1 less than of original. Copy the array elements from the original array minus the largest element. not select largest from the second array and compare with the previous one if not same return the second largest if same return -1


Write a c program to find the maximum of two numbers and print out with its position?

maxValue = function (array) {mxm = array[0];for (i=0; i<array.length; i++) {if (array[i]>mxm) {mxm = array[i];}}return mxm;}; i don't know


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 function is used to retrive the part of the string?

If a string features a separator (e.g. a dot or a comma), use PHP's explode() function to get an array with the two parts: $string = "hello,joe" $array = explode(",", $string); $array[0] will be "hello" $array[1] will be "joe" If not, you may use substr() to return a certain length of a string


What is the definition of hlookup?

It is a function that means horizantal lookup. you use it to search for a value in the first row of a table array and a return a value in the same column from another rowin the table array


What is return type of string in c?

In C programming, a string doesn't have a specific return type as it's essentially an array of characters. So, if a function is returning a string, it should be declared to return a pointer to a char (char*), since a string in C is represented as an array of characters terminated by a null character ('\0').


What is the array function in CAD?

there r 2 types of array in cad - rectangular array and polar array...........


Why the array is starting from zero?

By design; it makes the compiler's work easier. 1-based array's addressing-function: Address (array, index) = Address (array) + (index-1)*Elemsize(array) 0-based array's addressing-function: Address (array, index) = Address (array) + index*Elemsize (array)


Is it possible for a function to return more than one value at a time?

No, you can only return one value with a return statement. However, you can return a structure or pointer, so the real answer is yes, though requiring some added complexity.


What is recursive call in terms of algorithm?

A recursive call in an algorithm is when a function (that implements this algorithm) calls itself. For example, Quicksort is a popular algorithm that is recursive. The recursive call is seen in the last line of the pseudocode, where the quicksort function calls itself. function quicksort('array') create empty lists 'less' and 'greater' if length('array') ≤ 1 return 'array' // an array of zero or one elements is already sorted select and remove a pivot value 'pivot' from 'array' for each 'x' in 'array' if 'x' ≤ 'pivot' then append 'x' to 'less' else append 'x' to 'greater' return concatenate(quicksort('less'), 'pivot', quicksort('greater'))