Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Third International Conference Achids 2011 Daegu Korea April 2011 Proceedings Part 2 Lnai 6592

Authors: Ngoc Thanh Nguyen ,Chong-Gun Kim ,Adam Janiak

2011th Edition

3642200419, 978-3642200410

More Books

Students also viewed these Databases questions

Question

9. Explain the relationship between identity and communication.

Answered: 1 week ago

Question

a. How do you think these stereotypes developed?

Answered: 1 week ago

Question

a. How many different groups were represented?

Answered: 1 week ago