Advertisement
zopper

blbnouci alokace

Nov 25th, 2011
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. /* definice fce */
  2.  
  3. void stackInit(t_stack *s){
  4.         s=malloc(sizeof(struct t_stack));
  5.         s->top=-1;
  6.         if(s!=NULL)
  7.             printf("guuuuuuuu!!!! %d\n",s->top); // tohle se vypise - v poradku
  8. }
  9.  
  10. /* volani fce */
  11.  
  12. t_stack* s=NULL;
  13. stackInit(s);
  14.  
  15. if(s == NULL)
  16.     printf("pruuuuuser!!\n");   // Tohle se vypise taky, i kdyz by vubec nemelo...
  17.                     // Jako by se alokovalo jen na zasobniku... :(
  18.  
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement