All pastes #92685 Raw Edit

Neger infisso

public c v1 · immutable
#92685 ·published 2006-07-19 20:36 UTC
rendered paste body
int startpos;int endpos;stack s; char buf[BUFSIZE];for (i=0; i < strlen(stringa); i++) { 	switch(stringa[i]) {		case '(':			push(s,i);			// crea_livello()            //------------->  imposta un sottoalbero radice,figlio sx, figlio dx			break;		case ')':			startpos=pop(s);			endpos=i;			//printf("%d ~ %d\n", startpos, endpos);			memset(buf, 0, sizeof(buf));			strncpy(buf, stringa+startpos+1, i-startpos); 	// copia i caratteri da "(" fino a "+,/,-,*"			printf("src2: %s\n", buf);			// set_figlio_dx(buf)			break;		case '+':		case '-':		case '*':		case '/':			startpos=pop(s);			memset(buf, 0, sizeof(buf));			strncpy(buf, stringa+startpos+1, i-startpos); 	// copia i caratteri da "(" fino a "+,/,-,*"			printf("src1: %s\n", buf);			prinff("op  : %c\n", stringa[i]);			push(s,i);					// imposta il nuovo punto di inizio per la II parte			// set_figlio_sx(buf)			// set_radix_val(stringa[i])			// setta l'operatore voluto come radice del sottoalbero			break;		default:			break	}}