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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:40:17+00:00 2026-05-15T18:40:17+00:00

I have been trying to solve this problem the whole day: How do I

  • 0

I have been trying to solve this problem the whole day:

How do I pass a double array to a function?

Here is an example:

int matrix[5][2] = { {1,2}, {3,4}, {5,6}, {7,8}, {9,10} };

And I wish to pass this matrix to function named eval_matrix,

void eval_matrix(int ?) {
    ...
}

I can’t figure out what should be in place of ?

Can anyone help me with this problem?

I know that an array can be passed just as a pointer, but what about a double array (or triple array?)

Thanks, Boda Cydo.

  • 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-15T18:40:18+00:00Added an answer on May 15, 2026 at 6:40 pm

    To be usable as an array the compiler has to know the inner stride of the array, so it’s either:

    void eval_matrix( int m[5][2] ) { ...
    

    or:

    void eval_matrix( int m[][2], size_t od ) { ... /* od is the outer dimension */
    

    or just:

    void eval_matrix( int* p, size_t od, size_t id ) { ... /* ditto */
    

    In any case it’s syntactic sugar – the array is decayed to a pointer.

    In first two cases you can reference array elements as usual m[i][j], but will have to offset manually in the third case as p[i*id + j].

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

Sidebar

Related Questions

I have been trying to solve this bug for 2 days straight and can't
I hope somebody could help me out, I have no idea how to solve
I have a webapp written in PHP using a MySQL database backend. This question
I just read this question and this question , and since then I have
I've got a function that currently grabs all folders and sub-folders to check the
I'm dealing with a design problem that I'm sure has a simple answer and/or
I am trying to build an application to help our marketing team manage a
I've been asked to populate a flash file with some data from a database.
I developed a winforms application in C# 4.0 that uses a .dll to communicate
I am connecting to a MS SQL server through SQL Alchemy, using pyodbc module.

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.