We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
That's just the thing. I know could do it that way, but I want the amount of array's to be
dynamic.
mccarl
By dynamic do you mean, the array expands as you keep putting more items in it, or just that you can set the dimensions at runtime?
The first option doesn't exist in C. If you want something that expands you have to do it yourself by allocating a bigger array, copying over the data from the original smaller array into the new bigger array and then delete the original array.
The second option, you can do in 2 ways. Do you know the size of one of the dimensions? If so, you can do
then you get an array with one fixed dimension and one dimension set at runtime.
If you want both dimensions to be able to be set at runtime, then you have to change a bit more code. You can no longer use the array as thespliced[3][6], because the actual address that that refers to is calculated at compile time and if you don't know one of the dimensions, the compiler can't work it out.
int splice(char *string, char thespliced[], int xDim)
and then you access the array like...
thespliced[i * xDim + j]; // where i and j are the indexes into the array, and xDim is the size of the first dimension
Hope that helps
phoffric
Please post your parse and main functions.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
dynamic.