Saturday, April 10, 2021

20.42. Write a program that read and display an array of string.

#include<stdio.h>
#include<conio.h> 
#include<stdlib.h>
#include<string.h>
void main () 
{
void main ()
char *st[100];
int i, n;
st=(char *)malloc(sizeof(char)*100);
clrscr ();
printf("How many line: ");
scanf("%d\n",&n);
for(i=0; i<n; i++)
gets(st[i]);
for(i=0;i<n;i++)
printf("\n%s", st[i]);
getch();
}

No comments:

Post a Comment