Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct node {
- char *name;
- int x;
- } node_t;
- int main() {
- int i;
- node_t *array = malloc(sizeof(node_t) * 20);
- for (i = 0; i < 20; i++) {
- array[i].x = i;
- array[i].name = malloc(sizeof(char) * 30);
- strcpy(array[i].name, "akshay");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment