4.2 [5 marks] Write a function int stock_cmp (void *stock1, void *stock2) that compares two stock_t typed values pointed shou

4.2 [5 marks] Write a function int stock_cmp (void *stock1, void *stock2) that compares two stock_t typed values pointed should return: to by stock1 and stock2. The function -1, if the stock record pointed to by stock1 has an than that of the stock record pointed to by stock2; alphabetically smaller stock code alphabetically larger stock code 1, if the stock record pointed to than that of the stock record pointed by stock1 has an to by stock2; 0, if the two stock records pointed to by stockl and stock2 have the same stock code. For example, if stock1 points to a record {“APL”, 22.0, 148.9} and stock2 points to a record “GGL”, 85.3, 950.2}, the function should return -1 since “APL”



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *