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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:18:42+00:00 2026-06-12T10:18:42+00:00

what is this syntax for double x[] ? Is it a C way to

  • 0

what is this syntax for double x[]?

Is it a C way to declare an array?

If I have a function like

void evaluate(double x[], double *f)
{
   // evaluate
}

Can I pass a parameter x with any length?

  • 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-12T10:18:44+00:00Added an answer on June 12, 2026 at 10:18 am

    A parameter of array type behaves exactly like it is a pointer. You can not truly pass an array as a function argument. However, this syntax gives the illusion that you can for the sake of readability. So your function is equivalent to:

    void evaluate(double *x, double *f)
    {
      // evaluate
    }
    

    From §8.3.5/5 of ISO/IEC 14882:2011:

    After determining the type of each parameter, any parameter of type “array of T” or “function returning T” is adjusted to be “pointer to T” or “pointer to function returning T,” respectively.

    An expression that denotes an array will decay to a pointer to its first element, so you can still do this:

    void evaluate(double x[]);
    int array[] = {1, 2, 3, 4, 5};
    evaluate(array); // The array decays to a pointer to its first element
    

    From §4.2:

    An lvalue or rvalue of type “array of N T” or “array of unknown bound of T” can be converted to a prvalue of type “pointer to T”. The result is a pointer to the first element of the array.

    So yes, you can indeed pass an array of any length. In reality, you are just passing a pointer to the first element. You will, however, need to pass the length of the array as well, if you need it.

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

Sidebar

Related Questions

I have an external function which has following syntax: public void Set<FieldType>( Field field,
Can we initialize an array of double[][][] as double[1][2][3] (this is not the correct
I've seen this syntax show up, and have tried to google for it's definition
I find this syntax astoundingly annoying. Every time I rename my class, I have
I'm sure I have seen this syntax <%= Url.Action((MyController c) => c.MyMethod(a)) %> or
I know I've seen this syntax before, but I can't remember it/find it on
I'm just wondering where this syntax documented: 1 > 2 || raise(error) I have
I have a SQLite table called Price like this: date, productId, price ---------------------- 20120601,
In C# I can write something like this: class AnyThing<T> { static public T
I have a Postgresql PL/pgSQL function that has a double nested FOR loop, where

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.