Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 989115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:44:23+00:00 2026-05-16T05:44:23+00:00

I have an array int arr[5] that is passed to a function fillarr(int arr[])

  • 0

I have an array int arr[5] that is passed to a function fillarr(int arr[]):

int fillarr(int arr[])
{
    for(...);
    return arr;
}
  1. How can I return that array?
  2. How will I use it, say I returned a pointer how am I going to access it?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:44:23+00:00Added an answer on May 16, 2026 at 5:44 am

    In this case, your array variable arr can actually also be treated as a pointer to the beginning of your array’s block in memory, by an implicit conversion. This syntax that you’re using:

    int fillarr(int arr[])
    

    Is kind of just syntactic sugar. You could really replace it with this and it would still work:

    int fillarr(int* arr)
    

    So in the same sense, what you want to return from your function is actually a pointer to the first element in the array:

    int* fillarr(int arr[])
    

    And you’ll still be able to use it just like you would a normal array:

    int main()
    {
      int y[10];
      int *a = fillarr(y);
      cout << a[0] << endl;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 499k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There's absolutely no need to use a DataGrid for something… May 16, 2026 at 12:30 pm
  • Editorial Team
    Editorial Team added an answer Old stuff, it probably was never tried on a user… May 16, 2026 at 12:30 pm
  • Editorial Team
    Editorial Team added an answer You can always use HttpPostedFile.InputStream and Image.FromStream method to combine… May 16, 2026 at 12:30 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Lets say I have an array like int arr[10][10]; Now i want to initialize
I have the following two dimensional array: static int[,] arr = new int[5, 5]
I have a very big constant array that is initialized at compile time. typedef
I have a function that takes a struct, and I'm trying to store its
I have an Array like: private static int[] f_arme = { R.drawable.frankiearmevor_0001, R.drawable.frankiearmevor_0002, R.drawable.frankiearmevor_0003,
I have an array of a large structure that I am trying to output
I have a function in a DLL (the c header is): int my_c_function( const
I have a struct with a dynamic array inside of it: struct mystruct {
So I'm declaring and initializing an int array: static final int UN = 0;
ok so i have an array adapted listview (the array adapting is done in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.