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 8518803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:05:07+00:00 2026-06-11T06:05:07+00:00

I have defined an array: float array[3][4][5]; then, what is the difference when array,

  • 0

I have defined an array:

float array[3][4][5];

then, what is the difference when

array, array[0], array[0][0], &array[0][0][0]

used as function argument?

  • 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-06-11T06:05:09+00:00Added an answer on June 11, 2026 at 6:05 am

    The important thing to learn is that, in C, arrays aren’t passed as parameters in their entirety. Instead, the pointer to the first element of the array is passed.

    So, given the definition float array[3][4][5];…

    array (as a parameter) will be of type float (*)[4][5], a pointer to a two-dimensional array of floats (explanation: we can’t pass the array, we pass the pointer to its first element, which is a 4×5 array, hence float (*)[4][5]).

    array[0] (as a parameter) will be of type float (*)[5], a pointer to a one-dimensional array of floats (explanation: array[0] is a 4×5 array, we can’t pass the array, we pass the pointer to the first element of it, the first element being an array of 5 elements, hence float (*)[5]).

    array[0][0] (as a parameter) will be of type float *, a pointer to a float (explanation: array[0][0] is an array of 5 elements, we can’t pass the array, we pass the pointer to the first element of it, the first element being a float, hence float *).

    &array[0][0][0] (as a parameter) will be of type float *, a pointer to a float (explanation: array[0][0][0] is a float, we pass a pointer to it, hence float *).

    Perhaps, a more elaborate example:

    #include <stdio.h>
    
    int x[3][5] =
    {
      {  1,  2,  3,  4,  5 },
      {  6,  7,  8,  9, 10 },
      { 11, 12, 13, 14, 15 }
    };
    
    int (*pArr35)[3][5] = &x;
    // &x is a pointer to an array of 3 arrays of 5 ints.
    
    int (*pArr5a)[5] = x;
    // x decays from an array of arrays of 5 ints to
    // a pointer to an array of 5 ints,
    // x is a pointer to an array of 5 ints.
    
    int (*pArr5b)[5] = &x[0];
    // &x[0] is a pointer to 0th element of x,
    // x[0] is an array of 5 ints,
    // &x[0] is a pointer to an array of 5 ints.
    
    int *pInta = x[0];
    // x[0] is 0th element of x,
    // x[0] is an array of 5 ints,
    // x[0] decays from an array of 5 ints to
    // a pointer to an int.
    
    int *pIntb = *x;
    // x decays from an array of arrays of 5 ints to
    // a pointer to an array of 5 ints,
    // x is a pointer to an array of 5 ints,
    // *x is an array of 5 ints,
    // *x decays from an array of 5 ints to
    // a pointer to an int.
    
    int *pIntc = &x[0][0];
    // x[0][0] is 0th element of x[0],
    // where x[0] is an array of 5 ints,
    // x[0][0] is an int,
    // &x[0][0] is a pointer to an int.
    
    int main(void)
    {
      printf("&x=%p x=%p &x[0]=%p x[0]=%p *x=%p &x[0][0]=%p\n",
             pArr35, pArr5a, pArr5b, pInta, pIntb, pIntc);
    
      return 0;
    }
    

    Output (ideone):

    &x=0x804a040 x=0x804a040 &x[0]=0x804a040 x[0]=0x804a040 *x=0x804a040 &x[0][0]=0x804a040
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java array defined already e.g. float[] values = new float[3]; I
I have filled a dynamic allocated float multi array in a function. A second
Let's say I have defined an array float floatBuffer[4] and I have a struct:
I have defined an array like so : var myArray = {myNewArray: ['string1' ,
I have defined the TextView array as final. And I set a OnClickListener() for
I have these methods. I have defined a char array in stringcontent.h file and
I have an array defined as; static double Temp_data[TABLE_SIZE]; I want to change the
An array is defined of assumed elements like I have array like String[] strArray
Background I have an array of objects (Users) defined and set as follows: //
I have a problem initializing an array whose size is defined as extern const.

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.