Tuesday 10 January 2012

C program to print a character pattern using pointers



#include<stdio.h>
main()
{
char a[20],*ptr;
int x,y;
printf("Enter any string\n");
scanf("%s",a);
printf("\nThe name is %s",a);
x=0;
while(x<=strlen(a))
{
printf("\n");
ptr=a;
for(y=0;y<x;y++)
{
printf("%c",*ptr);
ptr++;
}
x++;
}
}



You Like It!? Then kindly share with your Friends.
Comments
0 Comments

No comments:

Post a Comment