sizeof() function in c programming langugae

sizeof() function



  #include<stdio.h>
  #include<conio.h>
void main()
{
     struct student
  {
      char name [20];
      int age;
      int roll, sub1, sub2, sub3, sub4;
      int total;
  } //Body of Struct ends
	stud; // variable declaration of Student
    clrscr();
    printf("Enter the Record of the Student :\n");
    printf("Name: ");
    scanf("%s",&stud.name);
    printf("Age :");
    scanf("%d",&stud.age);
    printf("Roll No. : ");
    scanf("%d",&stud.roll);
    printf("Enter the marks of 4 subjects");
    scanf("%d%d%d%d%",&stud.sub1,&stud.sub2,&stud.sub3,&stud.sub4);
    printf("Grade of the student: %s is ",stud.name);

    stud.total=stud.sub1+stud.sub2+stud.sub3+stud.sub4;
    if(stud.total<240)
       printf("C");
       else
       if(stud.total<=320)
       printf("B");
       else
       printf("A");
getch();
}// main function body ends

Output


sizeof()-function 



Facebook Likes

Youtube