int main() { SL_DataType i; SeqList sl; SL_init(&sl,5); printf("长度:%d\n",SL_getLen(sl)); for(i=0;i<8;++i) SL_insert(&sl,i,0); print(sl); printf("长度:%d\n",SL_getLen(sl)); SL_insert(&sl,5,6); print(sl); printf("长度:%d\n",SL_getLen(sl)); SL_insert(&sl,5,1); print(sl); printf("长度:%d\n",SL_getLen(sl)); printf("%d\n",SL_delete(&sl,100)); print(sl); printf("长度:%d\n",SL_getLen(sl)); printf("%d\n",SL_delete(&sl,5)); print(sl); printf("长度:%d\n",SL_getLen(sl)); printf("%d\n",SL_remove(&sl,100)); print(sl); printf("长度:%d\n",SL_getLen(sl)); printf("%d\n",SL_remove(&sl,5)); print(sl); printf("长度:%d\n",SL_getLen(sl)); SL_clear(&sl); return 0; }
static void decrease_scope(SymbolTable* st) { //Erase symbol list for inner blocks only (must keep global symbols and function declarations) if(scope > 0) { // fprintf(stderr, "Removing last list of scope %d\n", scope); SL_remove(st, scope); } scope--; }