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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:37:02+00:00 2026-06-11T18:37:02+00:00

Are the 2 following functions essentially the same function? ie, is an int* exactly

  • 0

Are the 2 following functions essentially the same function?

ie, is an int* exactly the same as a int[]?

int myFunction(int* xVals, int* yVals, int nVertices);
int myFunction(int xVals[], int yVals[], int nVertices);

How can I use the 1st function? Ie, how can I pass arrays in the parameters? Is the following valid/correct?

int xVals[5], yVals[5], zVals[5];
myFunction(xVals, yVals, zVals, 5);

// or should it be..
myFunction(&xVals[0], &yVals[0], &zVals[0], 5);
  • 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-11T18:37:04+00:00Added an answer on June 11, 2026 at 6:37 pm

    In a function parameter list, then the function declarations are equivalent:

    int myFunction(int* xVals, int* yVals, int nVertices);
    int myFunction(int xVals[], int yVals[], int nVertices);
    

    However, this does not readily generalize. Inside a function, there is a big difference between:

    int AnotherFunction(void)
    {
        int array[] = { 0, 1, 2, 3 };
        int *iptr = &array[0];
        ...
    }
    

    And in a function interface, there’s a big difference between the two parameter types:

    int arrays_vs_pointers(int **iptrptr, int array[][12]);
    

    You also ask about (corrected):

    int xVals[5], yVals[5];
    myFunction(xVals, yVals, 5);
    
    // or should it be..
    myFunction(&xVals[0], &yVals[0], 5);
    

    These calls are both valid and are equivalent to each other.


    The answer to your original headline question ‘Is an int * exactly the same as an int []?‘ is No.

    There are a very limited number of circumstances under which they are equivalent, but there are many more circumstances where they are very different.

    The answer to your revised headline question ‘Is an int * parameter exactly the same as an int [] parameter?‘ is Yes!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using PostgreSQL 9.1.3 and the following functions: CREATE OR REPLACE FUNCTION cad(INOUT args
I have defined the following two functions test <- function(t) { return( (0.5*eta^2/theta)*(1-exp(-2*theta*t)) )
For example suppose I have the following two functions function a(param1) { console.log(param1); }
I have the following code: Some functions: A::A(int i_a) {cout<<int Ctor\n;} //conversion constructor void
I understand that functions can have attributes. So I can do the following: def
I'm using the following functions: # The epoch used in the datetime API. EPOCH
I am using the following functions for writing and reading 4098 floating point numbers
On my front end, I have following functions: method to encrypt: public static string
The following two functions are extremely similar. They read from a [String] n elements,
I have a few issues with the following php functions (part of a bigger

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.