Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct Test {
- struct Test* next;
- char* word;
- } my_struct_t, *myStruct;
- myStruct createStruct(){
- myStruct s = (myStruct)malloc(sizeof(my_struct_t));
- s->next = NULL;
- s->word = NULL;
- return s;
- }
- int main(){
- myStruct s = createStruct();
- s->word = strdup("asdf");
- printf("%s\n", s->word);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment