Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Dynamic Memory Allocation

1. Write a C program to Display array elements using calloc( ) function.


2. Write a program to allocate memory for an array of integers using malloc(). The
program should prompt the user to enter the number of elements in the array, and
then allocate memory for the array. The program should then read the elements
of the array from the user and print them out.
3. Write a program to allocate memory for an array of integers using calloc() and
then print the elements of the array.
4. Write a program to allocate memory for a structure using calloc() and then print
the elements of the structure.
5. Implement a C program to concatenate two strings dynamically. Prompt the user
to enter two strings of arbitrary lengths. Allocate memory dynamically to store
the concatenated string using malloc(). Concatenate the strings and display the
result.

You might also like