1. Write a program that uses calloc to create a memory block for storing 10 integers. Save the values of two integers at the end of the block with user input and print the contents of the entire block using a loop. Could the output differ if malloc is used instead of calloc?
2. Write a program that uses calloc to create space for an array of 10 pointers to strings. Key in a string (maximum length = 80), save it using malloc and store its pointer in the fifth array element.
3. Write a program that uses calloc for storing an array of two integers and initializes the elements to 1234 and 4321. Overwrite the same space to store four short integers that are input from the keyboard. Print both sets of values.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here