Problem
write a program in c language that passes array index as an argument to a user defined function and print the string in that function character by character.Note: use pointers to print the string character by character.
Solution - Code
#include<stdio.h>#include<conio.h>
void display(char *p, char end);
main()
{
char p[]="We are gonna be the best programmers ever.";
char end= '\0';
display(p,end);
printf ("\n\n",*p);
system("pause");
}
void display(char *p, char end)
{
printf ("\n",*p);
while (*p != end)
{
printf ("%c",*p);
p++;
}
}
No comments :
Post a Comment
Note: Only a member of this blog may post a comment.