igraph-help
[Top][All Lists]
Advanced

[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

Mile

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);
}
free(vectors);

Code untested, but shows the general idea.

--
Tamas



_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help


reply via email to

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