Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Thing{
- char *stuff;
- char **morestuff;
- int evenmorestuff;
- };
- Thing *thingarray;
- thingarray = malloc(sizeof(Thing));
- ....
- //And then allocating space for elements, which will get called an unknown amount of times
- Thing j;
- thingarray[count] = j;
- #include <vector>
- using namespace std;
- struct Thing
- {
- char *stuff;
- char **morestuff;
- int evenmorestuff;
- };
- int _tmain(int argc, _TCHAR* argv[])
- {
- vector<Thing> vt;
- char stuff = 'a';
- char *morestuff = "abc";
- Thing t;
- t.stuff = &stuff;
- t.morestuff = &morestuff;
- t.evenmorestuff = 0;
- int count = 10;
- for (int i = 0; i <= count; ++i)
- {
- t.evenmorestuff = i;
- vt.push_back(t);
- }
- Thing j;
- j.stuff = &stuff;
- j.morestuff = &morestuff;
- j.evenmorestuff = 0;
- vt[count] = j;
- return 0;
- }
Add Comment
Please, Sign In to add comment