D
divya
1.
If The size of the array is unknown during programming time then how is
such array declared??
Suppose there is an Array named arrClashname(size unknown at start),
Now when the clash occurs I want to store that name into the
arrClashname,
Therez a do while loop inside which has some conditions which decied
when clash occurs and a variable named Clash is set to true and its
name has to be added to arrClashtime.I also have a variable which hold
number of clashes (inumberclashes)which gets incremented evry time
clash occurs.
Since I don't know how many clashes may occur inside the loop I cannot
define a static arrClashname.
This way can it be done:-
Dim arrClashname(0)
arrClashname(0)="Start"
Do while(some condition)
.....
.....(some conditions which may make Clash true)
.....
If (Clash = true) then
inumberofclashes=inumberofclashes+1
ReDim Preserve arrClashname(inumberofclashes)
arrClashes(inumberofclashes) = clashname
Endif
.....
.....
Loop
Is this the right way of doing??? Or there is some other way?
Q2
How can I add more elements to an array created using ARRAY()
function??
Suppose
Dim arrhit
arrhit=ARRAY("start","dfd")
Now how can I add more elements to this array??
arrhit[1]="ssdfdf" directly or use redim first to increase the size and
then add new data??
Q3
Can an array hold elements of more than one datatype? If yes how is the
memory allocation done in this case?? are the elements with similar
datatypes stored together??
suppose array of integers so now if array starts at 1000 since integers
so second element will be at location 1002 third at 1004 and so easy to
fetch.But if it can hold elements of any datatype how does it know that
how many bytes should be fetched for a element which can be of any
datatype??
If The size of the array is unknown during programming time then how is
such array declared??
Suppose there is an Array named arrClashname(size unknown at start),
Now when the clash occurs I want to store that name into the
arrClashname,
Therez a do while loop inside which has some conditions which decied
when clash occurs and a variable named Clash is set to true and its
name has to be added to arrClashtime.I also have a variable which hold
number of clashes (inumberclashes)which gets incremented evry time
clash occurs.
Since I don't know how many clashes may occur inside the loop I cannot
define a static arrClashname.
This way can it be done:-
Dim arrClashname(0)
arrClashname(0)="Start"
Do while(some condition)
.....
.....(some conditions which may make Clash true)
.....
If (Clash = true) then
inumberofclashes=inumberofclashes+1
ReDim Preserve arrClashname(inumberofclashes)
arrClashes(inumberofclashes) = clashname
Endif
.....
.....
Loop
Is this the right way of doing??? Or there is some other way?
Q2
How can I add more elements to an array created using ARRAY()
function??
Suppose
Dim arrhit
arrhit=ARRAY("start","dfd")
Now how can I add more elements to this array??
arrhit[1]="ssdfdf" directly or use redim first to increase the size and
then add new data??
Q3
Can an array hold elements of more than one datatype? If yes how is the
memory allocation done in this case?? are the elements with similar
datatypes stored together??
suppose array of integers so now if array starts at 1000 since integers
so second element will be at location 1002 third at 1004 and so easy to
fetch.But if it can hold elements of any datatype how does it know that
how many bytes should be fetched for a element which can be of any
datatype??