Differentiating realloc and malloc function in c


Question 1)a)(i) Distinguish between realloc() and malloc() function in C.

(ii) Describe the purpose of each of the following declarations

1. int *p[10];

2. int (*p) [10];

3. int p (char *a);

4. int *p (char *a);

b) Write a C program using pointers to read the array of integers and prints its elements in descending order.

Question 2)a) Differentiate union and structure. For what types of applications are unions useful?

b) Describe with suitable examples self referencing structure.

c) Describe nesting of structure with suitable example. Can union be member of Structure and structure be a member of union? If yes, give suitable example.

Question 3)a) What do you mean by the array of structures? Describe with appropriate example.

b) Describe how to pass entire structure as parameter to function and how to return a structure from function.

c) Define a structure called Inventory that will explain following information:

i) Item_No

ii) Item_Name

iii) Unit_Price

iv) Quanitity_Recieved

v) Current_Count

vi) Supplier_Name

vii) Purchase_Date

Purchase_Date is member of another 'Date' structure. Using Inventory create array of items and write a C program to read the information about all items. While displaying final list calculate and display the purchase price for each shipment. Sort the list in ascending order of Item_No.

Question 4)a) Write a C program to count number of spaces on each line of text in a file.

b) Describe the following file handling functions in C with appropriate example:

i) feof()

ii) ferror()

iii) fseek()

iv) ftell()

Question 5)a) Write down the difference between text mode and binary mode.

b) Write a C program to read integer number from user and display it in binary format using bitwise operator.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Differentiating realloc and malloc function in c
Reference No:- TGS05679

Expected delivery within 24 Hours