Question: 1 #include 2 #include 3 #include s struct _string_pair t f 6 char * str1; char * str2; 9 typedef struct _string pair t string

 1 #include 2 #include 3 #include s struct _string_pair t f6 char * str1; char * str2; 9 typedef struct _string pairt string pair t; 10 u int main(void) f 12 char* line=

1 #include 2 #include 3 #include s struct _string_pair t f 6 char * str1; char * str2; 9 typedef struct _string pair t string pair t; 10 u int main(void) f 12 char* line= NULL size t sz; 13 14 string pair t ** array; 15 int count=0; 16 while (getline (&line , &sz, stdin) >= 0) { 17 18 19 20 21 array = realloc (array, (count+1) * sizeof (*array)); array [count] = malloc (sizeof (array [count])); array [count]->str1 - strdup(line); char * p = strchr (array [count]->str 1, ,-) ; if (p != NULL) { array [count]->str2 = strdup(strchr (line , -') + 1); 23 else 25 array [count]->str2 NULL; = 26 28 counttt; 29 30 for (int i-0; i str2); printf ("%s %s ", array [1]->str1, free(array[i]->stri); free(array[i]->str2); 31 34 as free (array); 36return EXIT SUCCESS

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!