2 Marks
2 Marks
UNIT V
2 marks
1.Define structure with examples.
A Structure is a collection of one or more values of different data types, grouped
together under a single name.
struct student
{
int rollno;
char name[25];
int marks[6];
int avg;
}s1;
Structure 1: stu_address
struct stu_address
{
int street;
char *state;
char *city;
char *country;
}
Structure 2: stu_data
struct stu_data
{
int stu_id;
int stu_age;
char *stu_name;
struct stu_address stuAddress;
}
The structure members are not allowed to initialize inside the structure
definition.The menmbers of structure are initialized using structure variable.
Example:
typedef int myint;
Now myint is an alias of int. From now on we can declare new int variables
using myint instead of int keyword.
myint i = 0;
1.Text File:
The data are stored as plain text.
2.Binary Files:
The data are stored in the binary form (0's and 1's).
They can hold a higher amount of data, are not readable easily, and provides better
security than text files.
11. List out the functions used to perform file input and output operation.
Writing to a File:
Syntax:
rewind( fptr);
EOF means end of file.When reading from a file, the program detect that it has
reached the end of the File. One way is to have a special marker at the end of the
file (EOF).It is used