Link to home
Start Free TrialLog in
Avatar of echardrd
echardrd

asked on

structure array problem/question

hello all

I am having problems with an idea regarding an App I am writing, and how to make use of a structure array.

Here is my question(s)...

I want to define a structure like
struct entity {
    char *entityKey;
    char *entityValue;
} *myentity;

Now I want to read in any number of entityKey, entityValue pairs.... Since the number of key/value pairs can vary from run to run of the application I do not want to statically define an upper limit on the size of my structure array, thus I would like to dynamically allocate it as I need it... make sense??? I hope...

Thus here are my questions is the above structure valid? if so how can I add a key/value pair to it? and then increment to the next point in the array for the next value/key pair... and then how do i read them.. how do I cycle through the structure once I have filled it up...

The goal is to not dimension the size of the structure array... How can I do this???

pseudo code or an example would be great...

any suggestions???

thanks all

echardrd
Avatar of gj62
gj62

ASKER CERTIFIED SOLUTION
Avatar of rechard
rechard

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
echardrd =rechard

echardrd,
Having multiple accounts is a violation of the membership agreement: https://www.experts-exchange.com/jsp/infoMemberAgreement.jsp 
I have removed all question points from both accounts so no further damage can be done.  An administrator will be contacting you shortly so they can discuss your options.
It is best if you come clean and indicate all the accounts you use when the administrator contacts you.
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod my absolute sincerest apologies. It was absolutely not my intention to do this. My intent was tolet these guys know I appreciated there help and then to award points to them... Since I was smart enough to post the same question twice, and two different guys helped me gj62 and Kdo, I was going to award both of them points. gj62 on this question since he was the only one to respond here and Kdo on the other post for this question since he only responded there.. It was absolutely not my intent to do this.

Please take my word for it and distribute the points to gj62 on this post https://www.experts-exchange.com/questions/20537024/structure-array-problem-question.html and to
Kdo for the post https://www.experts-exchange.com/questions/20537021/structure-array-problem-question.html

Once again sorry for the confusion, but having these 2 accounts on 2 different machines with "remember me" selected has added to my confusion.

Sincerest regrets.
echardrd/rechard