Write a program to allocate an array with malloc/calloc functions input the data and print the same on output screen

#include<stdio.h>
#include <stdlib.h>
int main()
{
	char *str;
	str = (char*)malloc(10 * sizeof(char)); 
	printf("Enter any String : ");
	scanf("%s",str);
	printf("Your String is : %s",str);
	return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Show Buttons
Hide Buttons