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

  • Home
  • SEARCH
  • 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 8969161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:33:14+00:00 2026-06-15T17:33:14+00:00

I am to convert some custom data structures into float** and pass them as

  • 0

I am to convert some custom data structures into float** and pass them as arguments of a method that is dealing with float** only.

In my first version, method takes only 2 float** as arguments, so that i easily have

MyClass::MyMethod(float** data1, float** data2){}

In a second version, I would like to vehicle a list of float** with length varying from one execution to the next.

I only have float*** as a solution, which is not nice at all.

MyMethod is C-stylish, I don’t want any vector, etc…

Other ideas?

Thanks

  • 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-15T17:33:15+00:00Added an answer on June 15, 2026 at 5:33 pm

    Return a struct containing some float**. You could even pass in an instance of the struct.

    It means that the called function doesn’t directly manipulate the caller’s float** which I think is cleaner.

    We’re solving this as C programmers, I understand that sometimes we’re constrained not to use true C++ techniques.

    If you have (apologies for any syntax errors it’s years since I wrote C)

     struct floatCarrier { float **ppFloat1, float **ppFloat2 } 
     typdef FloatCarrier struct floatCarrier
    

    Your interface now can be

     FloatCarrier myMethod (FloatCarrier in)  /* passed by value, as an example */
    

    the implementation of myMethod can work with the float** from the input FloatCarrier. If it needs to modify the arrays then it creates a new FloatCarrier with new float** instances and when it has finished it returns the new FloatCarrier. This does put some responsibility with the caller to grab the new float** from the returned struct, but somehow I like that, feels cleaner.

    As to whether you should have a known number of members or an array … well your example had exactly 2 parameters, so the struct would have two members, but you can have an array or anything you like.

    How does it solve your problem: you no longer need to change your caller’s float** hence no float***. We use a struct as a function can return only one value, so we package up the results into a single object.

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

Sidebar

Related Questions

I have tried to write an utility function that can convert my custom data
I've created a custom component that display some data to the page according to
I'm trying to convert some simple .htaccess rewrites into web.config xml; all is well
I am attempting to convert some text files into a pdf. Now the easiest
I'm trying to convert some VB.net code into C# and having issues trying to
I had to convert some code (which deals with building a VBO of data
I need to convert some strings, and pull out the two first integers e.g:
I have some json formatted data that I parse with JSON.parse. The problem I
I'm developing an asp.net application that has some potentially large data tables. I would
I have some data files to import into a database with some unique delimiters:

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.