Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. typedef struct
  2. {
  3.     int id;
  4.     char *name;
  5. }Object;
  6.  
  7. Object* object_ctor (int id, char *name)
  8. {
  9.     Object *item = NULL;
  10.     int i;
  11.  
  12.     if ((item = malloc(sizeof(item))) == NULL)
  13.         {
  14.             printf("Incializace se nezdarila!");
  15.             return NULL;
  16.         }
  17.     item ->id = id;
  18.     strcpy(item ->name, name);
  19.     return item;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement