Guest User

Untitled

a guest
Mar 14th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. typedef struct Test {
  6.     struct Test* next;
  7.     char* word;
  8. } my_struct_t, *myStruct;
  9.  
  10. myStruct createStruct(){
  11.     myStruct s = (myStruct)malloc(sizeof(my_struct_t));
  12.     s->next = NULL;
  13.     s->word = NULL;
  14.    
  15.     return s;
  16. }
  17.  
  18. int main(){
  19.    
  20.     myStruct s = createStruct();
  21.     s->word = strdup("asdf");
  22.    
  23.     printf("%s\n", s->word);
  24.    
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment