Question: In C program Problem 1: Malloc and Realloc. Your job today is to create a program that takes in an arbitrary amount of data and

In C program
Problem 1: Malloc and Realloc. Your job today is to create a program that takes in an arbitrary amount of data and stores it into a correctly sized array. You will do this for 4 data types Interger .Double . Character . String The user should be allowed to enter an infinite number of any of these data types. Your program should identify what data type was received, and then store it in the appropriate array. Make sure you dynamically allocate enough space for the array. The contents of all four arrays should be displayed after each input. Example Enter your input: 123 String list Integer list: 123 Double List: Character list: Enter your input: 7.5 String list Integer list: 123 Double List: 7.5 Character list: Enter your input: s String list Integer list: 123 Double List: 7.5 Character list: s Enter your input: 1.0.0 String list: 1.0.0 Integer list: 123 Double List: 7.5 Character list: s Enter your input: Malloc is fun String list: 1.0.0 Malloc is fun Integer list: 123 Double List: 7.5 Character list: s Hints Use Integers to keep track of how many elements of each type you have (to use with realloc) .Before using realloc, you MUST malloc (even if you just malloc a size of 0) Strings are arrays of characters(you will need to malloc a 2d array) Break this problem into smaller parts-tackle them one at a time
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
