troubleshooting Question

when transferring a string to a function how can I refer to it as an array name?

Avatar of star90
star90 asked on
7 Comments1 Solution277 ViewsLast Modified:
I am writting a function to initialize arrays.

I have arrays with different size and types.
  double One [30]
   int two [40]
so I wrote a function to initialize them:
To call the function: ArrayInitialize ("One",0,30);

void ArrayInitialize2D(string Arrayname,int initvalue,int xsize);
   int i;
      if (Arrayname=='One')
        for (i=0;i<=xsize ;i++)

   if (Arrayname=='TWO')
        for (i=0;i<=xsize ;i++)

} // end of function

My question:
Is there a way to convert the array name (e.g. string "One")
to a real variable that represent an array name
something like:
Inside the function:
 for (i=0;i<=xsize ;i++)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros