Guest User

Untitled

a guest
Dec 14th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. typedef struct node {
  6. char *name;
  7. int x;
  8. } node_t;
  9.  
  10. int main() {
  11. int i;
  12. node_t *array = malloc(sizeof(node_t) * 20);
  13. for (i = 0; i < 20; i++) {
  14. array[i].x = i;
  15. array[i].name = malloc(sizeof(char) * 30);
  16. strcpy(array[i].name, "akshay");
  17. }
  18. return 0;
  19. }
Add Comment
Please, Sign In to add comment