Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct waffle
  5. {
  6.     char *name;
  7.  
  8. } waffle;
  9.  
  10. waffle *scan(int *number);
  11.  
  12. int main(void)
  13. {
  14.   waffle nom;
  15.   int count=0;
  16.      
  17.  
  18.   nom = scan(&count);           // Is this right to count variable in pointer function?
  19.  
  20.   printf("count is :%d", count);    // so that output will be valid here.
  21.  
  22.  
  23.     return 0;
  24. }
  25.  
  26. waffle *scan(int *number)
  27. {    
  28.     int i;
  29.     waffle *syrup;
  30.     char *buff;
  31.    
  32.     for (i = 0; i <5; i++)
  33.     {
  34.         printf("Name first waffle:\n>");
  35.         scanf("%s", buff);
  36.            
  37.         syrup[i].name = (char*) calloc( strlen(buff+1), sizeof(char) );
  38.  
  39.     number++;               //  Like this ?
  40.     }
  41.  
  42.     return syrup;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement