22 February 2024 0 6K Report

Objective : get strings and allocate memory using malloc and print the strings.

#include

int main()

{

int i, n, l;

char *str;

printf("Number of strings: ");

scanf("%d", &n);

str=(char*)malloc(n*sizeof(char));

for (i=0; i

More Sanjay Agal's questions See All
Similar questions and discussions