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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:47:10+00:00 2026-06-03T00:47:10+00:00

I have written a C++ application and within it, I need to call a

  • 0

I have written a C++ application and within it, I need to call a math function that was written in C. The prototype looks like:

void Jacobi_Cyclic_Method(double *eigenvalues, double *eigenvectors, double *A, int n);

My problem is that I can’t seem to pass the function double * (for instance both eigenvectors and A are multi-dimensional arrays. The C++ way to pass those things seems to be

double [][size]

I have read about extern C but I don’t think it applies here since I am not interfacing with an object but with source itself. How can I send that C function my multi-dimensional arrays defined as such:

double [100][100] A;
double [100][100] eigenvectors;
double [100] eigenvalues;

Trying to compile I get:

error: no matching function for call to ‘MathEngine::Jacobi_Cyclic_Method(double 
[100], double [100][100], double [100][100], int)’
mathEngine.h:9: note: candidates are: static void    
MathEngine::Jacobi_Cyclic_Method(double*, double*, double*, int)
  • 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-03T00:47:12+00:00Added an answer on June 3, 2026 at 12:47 am

    I’m assuming that your C function requires multi-dimensional arrays for some of its parameters and that the prototype is written with pointers to doubles for the array/matrix parameters where the integer parameter indicates the size of each dimension (I guess the matrices are square?). If this is the case then you can pass a pointer to the first element of each array/matrix like this:

    Jacobi_Cyclic_Methods(&eigenvalues[0], &eigenvectors[0][0], &A[0][0], 100);
    

    Your initial attempt doesn’t work because the type of, for instance, eigenvectors is double[100][100] which decays to double (*)[100], not double *.

    This post addresses the issue of pointers and multi-dimensional arrays.

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

Sidebar

Related Questions

I have written an application for Android. the main part being that it communicates
I have written a WinForms application (C# 2.0, VS2008) that registers several file types
I have written an application that unit tests our hardware via a internet browser.
I need to design a windows application that will reside within an organization's intranet.
Brief Description of the app: I have written a Delphi application that allows a
i have written an application, but for some reason it keeps peaking at 100%.
I have written a application which runs in the background. I want to write
I have written an application in which I want to convert a .jpg image
I have written an application which triggers an IP Camera to stream it's data
it's late, I'm tired, and probably being quite dense.... I have written an application

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.