[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] vector of igraph_vector_t vectors

From: Mile Sikic
Subject: Re: [igraph] vector of igraph_vector_t vectors
Date: Wed, 14 Apr 2010 14:09:03 +0200

I get a clue, thank you


On Wed, Apr 14, 2010 at 9:35 AM, Tamas Nepusz <address@hidden> wrote:
> Could you give me an example how I can make vector of 100 igraph_vector_t objects and how I should handle memory
> thank you.
Well, if you only need 100 vectors (in other words, if the number of igraph_vector_t objects you need is fixed), you don't really need an igraph_vector_ptr_t for that, you can simply allocate 100 igraph_vector_t objects using calloc:

igraph_vector_t* vectors;
vectors = (igraph_vector_t*)calloc(100, sizeof(igraph_vector_t));
for (i = 0; i < 100; i++) {
 igraph_vector_init(vectors + i);
[...do whatever you want with your vectors...]
for (i = 0; i < 100; i++) {
 igraph_vector_destroy(vectors + i);

Code untested, but shows the general idea.


igraph-help mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]