Sunday, September 7, 2014

print a string in a user defined function, where string is declared in main function


Problem

write a program in c language that passes array index as and argument to a user defined function and print the string in that function.

Solution - Code

#include<stdio.h>
#include<conio.h>
void display(char *p);
main()
{
 char p[]="Mr.Maaz Ali is a good boy.";
 display(p);
 system("pause");
}
void display (char *p)
{
 printf("\n%s\n\n",p);
}

Sample Output

print string in a function, defined in main

No comments :

Post a Comment

Note: Only a member of this blog may post a comment.

Copyright 2017. All Rights Reserved. Privacy Policy / Terms And Conditions / Sitemap / Contact