vector

Posted By: chit

vector - 01/12/11 02:31

i just want to ask if it is possible to create a array of VECTOR?
i'm just newbie
Posted By: Logan

Re: vector - 01/12/11 03:24

Code:
VECTOR* vector_array[100];



Yessir.
Posted By: JibbSmart

Re: vector - 01/12/11 03:31

Or
Code:
VECTOR vector_array[100];

...if you want an array of VECTOR and not VECTOR pointers.

Jibb
Posted By: chit

Re: vector - 01/12/11 09:28

thanks a lot my friend it help's a lot for me
Posted By: chit

Re: vector - 01/12/11 09:30

my friend i just want to ask again if it is possible in two dimensional array
Posted By: Logan

Re: vector - 01/12/11 09:36

Best way to find out is to declare a two dimensional VECTOR array in SED and hit Run. If you get an error, it's not possible. If you don't, it is possible. tongue

Experimentation is the best way to learn programming if you ask me. Don't be afraid of the compiler yelling at you, it doesn't care. If you WISH something worked, try it, and worst case you'll know it doesn't if you get a compiler error. Best case, you just solved your own problem.
Posted By: carlpa

Re: vector - 01/12/11 16:18

I have recieved a curious system crash defining VECTOR* any_name[15] then trying to use any_name[i].x or ".y". I think one has to formally refer to the VECTOR pointer. Would (any_name)[i].x or &any_name[i].x work? Just curious as to how and requesting education.
Posted By: Rei_Ayanami

Re: vector - 01/12/11 16:19

Just try without the star * else you have just a pointer to a vector, but no actual vector wink
Posted By: carlpa

Re: vector - 01/12/11 16:24

I thought that may be the best answer. Please correct me if the following is wrong:

VECTOR any_name[15];
then refer to the pointer with &any_name[i]

A silly thing I should know pat but I just followed examples. Thank you.
Posted By: DJBMASTER

Re: vector - 01/12/11 16:25

if a is a structure type use a.b to get the member b of a. If it's a pointer type you can use a->b or (*a).b.
Posted By: carlpa

Re: vector - 01/12/11 16:28

Thanks. I use VB, C++, Lite C, Java and once Pascal and C. My poor old brain gets confused.
© 2024 lite-C Forums