answersLogoWhite

0

number = myfirstfunction (text, freq); // The first function, where "text" is a string, // and "freq" is the array that is filled with data mysecondfunction (number, freq); // The 2:nd function where the value from the previous // function is being used, and the array "freq" is // bring printed.

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran

Add your answer:

Earn +20 pts
Q: How do you reference a array from one function to another?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

How do you pass a one-dimensional array to user-defined functions?

In C++ you would pass a std::array if the array is fixed-length, otherwise you'd use a std::vector. Most object oriented languages will provide some method of passing a self-contained array object to a function. In C and other non-object oriented languages you would pass a reference or pointer to the start address of the array along with a variable indicating the number of valid elements within the array. The array type will determine the size of each element.


How are entire arrays passed from one method to another?

In some programming languages, like C, you can pass the new method (or function) an address pointer to the first element in the array. As long as you don't leave the scope of the method the array was created in, the array will remain valid. In other languages that don't support memory addresses, like FORTRAN, it must be done by making the array global.


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


What is the definition of parent function?

When a function is nested inside another function, the outer one is the parent, the inner is the child.


How do you identify a function?

A function is a mapping from one set to another such that each element from the first set is mapped onto exactly one element from the second set.