praveenkumar450
Newbie level 5
- Joined
- Jul 2, 2014
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Location
- Hyderabad, Andhra Pradesh, India
- Activity points
- 55
C program for to store and access the student id, name and percentage using structures
NOW THE QUESTION IS WE CAN OR WE CAN'T DECLARE THE STRUCTURE.C LIKE STRUCTURE HEADER FILE LIKE #INCLUDE "STRUCTURE.H"
IS IT EXECUTE OR NOT
Code:
#include <stdio.h>
#include <string.h>
struct student
{
int id;
char name[20];
float percentage;
};
int main()
{
struct student record={0};
record.id = 450;
strcpy(record.name,"praveen");
record.percentage = 75.13;
printf("ID of the Student is : %d\n",record.id);
printf("\nName of the student is : %s\n",record.name);
printf("\nPercentage of the studnt is : %.2f",record.percentage);
return 0;
}
NOW THE QUESTION IS WE CAN OR WE CAN'T DECLARE THE STRUCTURE.C LIKE STRUCTURE HEADER FILE LIKE #INCLUDE "STRUCTURE.H"
Code:
#include <stdio.h>
#include <string.h>
#include "structure.h"
int main()
{
record.id = 450;
strcpy(record.name,"praveen");
record.percentage = 75.13;
printf("ID of the Student is : %d\n",record.id);
printf("\nName of the student is : %s\n",record.name);
printf("\nPercentage of the studnt is : %.2f",record.percentage);
return 0;
}
IS IT EXECUTE OR NOT
Last edited by a moderator: