C program to read and print name, where memory for variable should be declared at run time

Опубликовано: 30 Ноябрь 2024
на канале: Priyanka Jamdar
91
2

Dynamic Memory Allocation Example: In this C program, we will declare memory character array (to read name) at run time, will read name and print the string.

This program is an example of Dynamic Memory Allocation, where maximum length of the name (number of characters) to be read at run time, program will declare memory for entered length of the name using malloc(), then program will read the name and print.