Non mi stampa nulla.codice:/* ### Copyright (c) 2004 Luca Francesca ### This script is provided under the terms of the GNU General Public License ### (see http://www.gnu.org/licenses/gpl.html for the full license text.) */ #include <stdio.h> #include <time.h> #include <stdlib.h> #include "Common.h" #define SIZE 100 typedef struct _Stack *Stack; struct _Stack { int stack[SIZE]; int top; }; Stack Init(int val); void Push(Stack st, int val); int Pop(Stack st); void Delete(Stack st); int main(int argc, char *argv[]) { srand(time(NULL)); Stack st = Init(10); int i = 0; for(i; i < SIZE; ++i) { Push(st, i); } for(i; i < SIZE; ++i) { printf("%d\n", Pop(st)); } Delete(st); ExitFunction(); return 0; } Stack Init(int val) { Stack tmp; tmp = malloc(sizeof(struct _Stack)); tmp->top = 0; tmp->stack[tmp->top] = val; return tmp; } void Push(Stack st, int val) { if(st->top == 0) return; st->stack[st->top++] = val; } int Pop(Stack st) { if(st->top == 0) return 0; else return st->stack[st->top--]; } void Delete(Stack st) { SAFE_DELETE(st) }
Why??