Skip to content
murmot

Results for “java function return array value example code 2 site:geeksforgeeks.org c”

  • geeksforgeeks.org

    How can I return multiple values from a function? - GeeksforGeeks

    In main() function, the returned structure is stored, and its values are printed. C also have some other methods to return multiple value from a function. They are as follows: Using Arrays. If the multiple values to be returned are of same type, then the array of these values can be returned.

  • geeksforgeeks.org

    Function With Return - GeeksforGeeks

    Oct 31, 2026 ... Given an integer n, You need to use the return keyword to return twice the value of n. Examples: Input: n = 2. Output: 4. Explanation: 2 * 2 = 4

  • geeksforgeeks.org

    Difference Between Function and Method - GeeksforGeeks

    A function is a block of code that performs a specific task and can return a value.Called using the object (or class name if static). Common in object-oriented programming languages like Java, Python, and C++. Example of Function (Procedural Language – C).

  • geeksforgeeks.org

    Arrays in Java - GeeksforGeeks

    Nov 20, 2026 ... 2. Returning an Array: A method can return an array reference by specifying an array type as its return type. static int[] getArray ...

  • geeksforgeeks.org

    How to return multiple values from a function in... - GeeksforGeeks

    By using Arrays. Example: Consider an example where the task is to find the greater and smaller of two distinct numbers. We could write multiple functions.Below is the program to return multiple values using array i.e. store greater value at arr[0] and smaller at arr[1].

  • geeksforgeeks.org

    Return an Array in C - GeeksforGeeks

    Another approach to return an array in C is using the static arrays. Once an array is declared static it's lifetime extends beyond the function scopes. The static keyword allows the array to retain its values between different function calls.

  • geeksforgeeks.org

    Array get() Method in Java - GeeksforGeeks

    Jul 23, 2020 ... Array get() Method in Java · array: The object array whose index is to be returned. · index: The particular index of the given array. The element ...

  • geeksforgeeks.org

    Java Tutorial - GeeksforGeeks

    Nov 21, 2026 · Java is a high-level, object-oriented programming language used to develop web, mobile, desktop, and enterprise applications. It is known for its platform independence, security, reliability, and extensive library support.