My Profile

I, Das ShrikKrishna J. MCA III IMSCD&R, Ahmednagar.
Showing posts with label Implement Structure with Functions(1st Meth). Show all posts
Showing posts with label Implement Structure with Functions(1st Meth). Show all posts

Monday, 15 August 2011

Implement Structure with Functions

Write a Program in C to implement Structure with Functions using 1st Method
#include<stdio.h>
#include<conio.h>
struct student
{
int roll;
char name[50];
};
void fun1(struct student s); //Function Prototype
void main()
{
struct student s1,s2;
printf("Enter Roll Number for Student 1\n");
scanf("%d",&s1.roll);
printf("\nEnter Name for Student 1\n");
scanf("%s",&s1.name);
printf("\n\nEnter Roll Number for Student 2\n");
scanf("%d",&s2.roll);
printf("\nEnter Name for Student 2\n");
scanf("%s",&s2.name);
printf("\n\nRoll Number \t Names \n\n");
fun1(s1); //Function call for s1
fun1(s2); //Function call for s2
getch();
}
 
void fun1(struct student s)
{
printf(" %d \t %s \n",s.roll,s.name);
}

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | cheap international calls