P183. Program to allocate dynamic memory for 1 string, scan it and print it.
#include<stdio.h>
#include<stdlib.h>
void
main()
{
char *c;
c=malloc(sizeof(char)*10);
scanf("%s",c);
printf("%s\n",c);
}
#include<stdio.h>
#include<stdlib.h>
void
main()
{
char *c;
c=malloc(sizeof(char)*10);
scanf("%s",c);
printf("%s\n",c);
}
Comments
Post a Comment