1. Create function double rand_double(double a, double b) that produces a random number between a and b inclusive
β’ The formula is: ((double) rand() / (double) MAX_INT) * (b β a) + a assuming b > a
β’ If b < a swap the values of a and b then call the above formula
β’ You need to #include <stdlib.h> to use the rand function
2. Create a structure foobarbaz that holds an int called foo and a double called bar and a second int called baz
3. Create a function with no arguments called rand_foobarbaz() that produces a foobarbaz struct using dynamic memory
β’ foo is initialized to a random value between 0 and 49,
β’ bar is initialized to a random value between 0.0 and 100.0
β’ baz is initialized to a random value between 50 and 99
β’ rand_foobarbaz() should return the pointer to this struct
4. Create a function with no arguments called many_foobarbaz()
β’ This function should produce an array of 20 foobarbaz structures using dynamic memory, and return it as a pointer.
5. Create a function that takes an array of foobarbaz struct pointers and prints them out, one structure per line
β’ Make sure it is appropriately formatted so that the foo, bar and baz values line up vertically
6. Create a function that takes a foobarbaz array and two integers, where each integer is less than the number of foobarbaz structures in the array, and swaps the two structures being pointed at
7. Create a main() that performs the following:
β’ Creates a foobarbaz array
β’ Prints the foobarbaz array
β’ Randomly creates two swap points
β’ Prints them on their own line with blank lines above and below
β’ Swaps the foobarbaz values at the two indices in the foobarbaz array β’ Prints out the foobarbaz array again
Make sure you free all malloced memory before exiting the program.






