Search This Blog

Translate

c structure program to accept student information and print using pointer

basic structure of c program,structure of c program pdf,structure of c program with example,structure of c program ppt, explain the basic structure of c program with an example,structure of c program notes


c structure program to accept student information and print using pointer


#include
#include
#define stud 2
struct student
{
  int roll;
  char name[50];
  char dept[25];
  char course[20];
  int yoj;
};
typedef struct student st;
void check_year(st *s);
void check_roll(st *s);
main()
{
  int i;
  st s[stud];
  st *p=s;
  clrscr();
  for(i=0;i  {
   printf("\n Enter the roll no:");
   scanf("%d",&s[i].roll);
   printf("\n Enter Name of student:");
   fflush(stdin);
   gets(s[i].name);
   printf("\n Enter department:");
   scanf("%s",s[i].dept);
   printf("\n Enter course:");
   scanf("%s",s[i].course);
   printf("\n Enter year of joining:");
   scanf("%d",&s[i].yoj);
  }
  check_year(p);
  check_roll(p);

 getch();
 return 0;
}
void check_year(st *s)
{
 int i,yoj;
 printf("\n Enter year of joinning whose record u want to see:");
 scanf("%d",&yoj);
 for(i=0;i {
  if(s->yoj==yoj)
  {  printf("\n Roll no:%d\n Name:%s",s->roll,s->name);
     printf("\n Department:%s \n course:%s \n year of joining:%d\n\n",s->dept,s->course,s->yoj);

  }
 }
}
void check_roll(st *s)
{
 int i,roll;
 printf("\n Enter roll no whose record u want to see:");
 scanf("%d",&roll);
 for(i=0;i {
  if(s->roll==roll)
  {  printf("\n Roll no:%d\n Name:%s",s->roll,s->name);
     printf("\n Department:%s \n course:%s \n year of joining:%d\n\n",s->dept,s->course,s->yoj);

  }
 }
}



basic structure of c program,structure of c program pdf,structure of c program with example,structure of c program ppt, explain the basic structure of c program with an example,structure of c program notes

C Program example List

Google+ Badge