hi, i have a simple question and would apprichiate if someone could give me a detailed explanation. so what i have is a structure like this:

Code:

typedef struct tuple{
	int x;
	struct tuple *childTuple;
}Tuple;
and the code that follows look like this:
Code:
int ntop = -1;

void fpush (Tuple *newTuple, Tuple **top,int topSize){
	if ( ntop== topSize){
		printf( "stack overflow");
		return;
	}
	ntop++;
	top[ntop] = newTuple;
}

int main(){
        Tuple *lastInterval = (Tuple *)malloc(100*sizeof(Tuple));
	Tuple **top = (Tuple **)malloc(sizeof(Tuple *));
	top[0] =(Tuple *)malloc(sizeof(Tuple));
	top[0]->childTuple = (Tuple *)malloc(100*sizeof(Tuple));
	lastInterval = NULL;
	top[0] = NULL;

	for (i=0;i<=100;i++){
		lastInterval = fcreateTup(i,i+1,i+2,lastInterval);
		fpush(lastInterval,top,200);
	}

}
so my question now is : do i need to allocate 100 times Tuple for:

Code:
Tuple **top = (Tuple **)malloc(sizeof(Tuple *));
top[0] =(Tuple *)malloc(sizeof(Tuple));
or not , because it seams to work both ways. and why does it work if it works and it is not just my imagination ?

cheers

baxy