@Kiran Karwa,
#include<stdio.h>
#include<stdlib.h>
int main() {
char str[20];
char *ptr;
int n;
//case 1
printf("Input a string");
gets(str);
puts(str);
//case 2
printf("Enter the size of the string");
scanf("%d",&n);
ptr=(char *)malloc(n*sizeof(char));
ptr="Hope is the bird with Feathers";
printf("%s",ptr);
free(ptr);
return 0;
}
Please kindly execute this code snippet. I hope you'll understand the difference between character array and pointer.