Вы находитесь на странице: 1из 19

JOGINPALLY B. R.

ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UNIT – IV

STRUCTURES

SHORT QUESTIONS AND ANSWERS (2M OR 3M)


-----------------------------------------------------------------------
1) What is structure? (OR)
Define the structure?

Definition of Structures : A Structure is a derived data type. A structure contains one or more data items
of same or different data types in which the individual elements can differ in type. A simple structure may
contain the integer elements, float elements, character elements etc. The individual structure elements are called
members.

The general format is :

struct tag_name
{
type1 member1;
type2 member2;
: :
: :
typeN memberN;
};

Where,
1 : struct : struct is the keyword which tells the compiler that a structure is being defined.
2 : tag_name : is the name of the structure.
3 : member1,member2, ….. , memberN are called members of the structure. They are also called fields of the
structure.
4 : The members are declared within curly braces. The members can be any of the data types such as int, char,
flat, etc.
5 : There should be semicolon at the end of closing brace.

Ex : struct student
{
char name[10];
int roll_number;
float average_marks;
};
The structure definition does not reserve any space in memory for the members. So, it is called a
structure template and memory will not be allocated for the template.

1
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2) How to decleration of the structure?

Declaration of Structures : After defining a structure format we can declare variables of that type. A
structure variable declaration is similar to the declaration of variables of any other data types.

The declaration of a structure varaiable has four parts,


1 : struct : is the keyword.
2 : tag_name : is the structure name.
3 : list of varaibels : followed by list of varaiables separated by commas.
4 : Followed by terminating semicolon.

Syntax : struct tag_name list of variables;

Ex : struct student it1,it2;

The complete structure definition along with structure declaration.

struct student
{
char name[10];
int roll_number; //structure definition.
float average_marks;
};
struct student it1,it2; //structure declaration.

Is same as…

struct student
{
char name[10];
int roll_number;
float average_marks;
} it1,it2;

OR even……

struct
{
char name[10];
int roll_number;
float average_marks;
} it1,it2;

Once the structure definition is associated with variables such as it1 and it2, the compiler allocates
memory for the structure variables. The number of bytes allocated for the variable it1 is

2
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

- 10 bytes are allocated for the field name


- 2 bytes for the field roll_number.
- 4 bytes for the field average_marks.

So, totally 16 bytes are reserved for the variable it1 and another 16 bytes are reserved for the variable it2.

3) How to initialization of the structure?

Initilization of Structures : The initializing structure variable is similar to that of arrays i.e, all the
elements will be enclosed within curly braces i.e, ‘{‘ and ‘}’ and are separated by commas.

Syntax : struct tag_name variable={v1,v2,…vn};

Where,

1 : “struct tag_name” is derived data type.


2 : v1,v2..vn are all the initial values. These values are called initilizers, they should be separated by commas
and should be enclosed between ‘{‘ and ‘}’.

Examples

1 :Initilization along with structure definion.

struct student
{
char name[10];
int roll_number;
float average_marks;

}it1={“jbrec”, 1000, 75};

2 : Initilization during structure declartion.

struct student
{
char name[10];
int roll_number;
float average_marks;
};

struct student it1={“jbrec”, 1000, 75};

3 : Initilization along with structure declaration with more than one variable.
3
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

struct student
{
char name[10];
int roll_number;
float average_marks;

} it1,it2={“jbrec”, 1000, 75};

4 : Initilization during structure declaration with more than one variable.

struct student
{
char name[10];
int roll_number;
float average_marks;

} it1={“jbrec”, 1000, 75}, it2={“jbrec”, 1000, 75};


Initializing both variables it1 and it2 can also be done as

struct student
{
char name[10];
int roll_number;
float average_marks;

};
struct student it1={“jbrec”, 1000, 75};
struct student it2={“jbrec”, 1000, 75};

NOTE : The members of the structure cannot be initilzed in the structure definition.

4) How to accessing of structure?

Accessing Structures : After declaring the structure type, variables and members, the members of the
structure can be accessed by using the structure variable along with dot(.) operator.

Syntax : variable.member;

Ex : struct student
{
char name[10];
int roll_number;
float average_marks;

};

4
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
struct student it1;
For accessing the structure members from the

it1.name; it1.roll_number; it1.average_marks;

Where ‘it1’ is the structure variable.

Write a program to print the student number, name and marks through accessing structure elements.

#include<stdio.h>
#include<conio.h>
struct std
{
int no;
char name[10];
int marks;
};
struct std s;
void main()
{
float total,avg;
printf("Enter student details:\n");
printf("\nEnter the student no:");
scanf("%d",&s.no);
printf("\nEnter the student name:");
scanf("%s",&s.name);
printf("\nEnter the student marks:");
scanf("%d",&s.marks);
printf("Rollno\tName\tMarksn");
printf("%d\t%s\t%d”,s.no,s.name,s.marks);
getch();

OUTPUT :Enter student details :


Enter the student no :5
Enter the student name :ravi
Enter the student marks :56

Rollno Name Marks


5 ravi 56

5) What is array of structure?

Arrays of structures : In ‘C’ language to declare an array of structure variable.

5
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Ex : if you want to handle more records within one structure, we need not specify the number of structure
variable. Simply we can use array of structure variable to store them in one structure variable.

Write a program to store number of records in one structure.

#include<stdio.h>
#include<conio.h>
struct std
{
int no,marks;
char name[10];
};
struct std s[5];
void main()
{
int i,n;
clrscr();
printf("Enter the number of Records");
scanf("%d",&n);
printf("Enter student details:\n");
for(i=0;i<n;i++)
{
printf("\nEnter the student no:");
scanf("%d",&s[i].no);
printf("\nEnter the student name:");
scanf("%s",&s[i].name);
printf("\nEnter the student marks:");
scanf("%d",&s[i].marks);
}
printf("Rollno\tName\tMarks\n");
for(i=0;i<n;i++)
printf("%d\t%s\t%d\n",s[i].no,s[i].name,s[i].marks);
getch();

6) What is nested structures?

Nested Structure : if a structure contains more than one structure as its members is known as a nested
structure. i.e, structure within another structure. It is used to increase the readability of the program by reducing
the complexity.

Ex :Write a program to read and write employee and their date of joining using nested structure.
#include<stdio.h>
#include<conio.h>
struct date

6
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{
int day;
char month[20];
int year;
};
struct employee
{
int code;
char name[30];
float salary;
struct date doj;
};
struct employee emp1;
void main()
{
printf("Enter Employee code:");
scanf("%d",&emp1.code);
printf("Enter Employee name:");
scanf("%s",&emp1.name);
printf("Enter Employee salary:");
scanf("%f",&emp1.salary);
printf("Enter Employee date of joining:");
scanf("%d%s%d",&emp1.doj.day,&emp1.doj.month,&emp1.doj.year);
printf("Display the Employee Details\n");
printf("Code\tName\tSalary\tDOJ\n");

printf("%d\t%s\t%.2f\t%d%s%d",emp1.code,emp1.name,emp1.salary,emp1.doj.day,emp1.doj.month,emp1.doj.
year);
getch();
}

7) Describe about structures and functions?

Structures and functions: The general format of sending a copy of a structure to the called function is:

Function_name(structure_variable_name);

The called function takes the following form:

data_type function_name(struct tag_name var)


{
----------
----------
return(exp);
}

//Write a C program passing a copy of the entire structure.


7
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>

struct emp
{
char name[30];
int points;
double sal;
};
struct emp update(struct emp e, int p, double s);
void main()
{
int p_inc;
double sal_inc;
struct emp e={“urname”, 100, 30000};
printf(“enter points increment and salary increment”);
scanf(“%d%f”,&p_inc,&sal_inc);
e=update(struct emp e, p_inc, sal_inc);
printf(“updated values of employee”);
printf(“name :%s\n”, e.name);
printf(“Points :%d\n”, e.points);
printf(“Salary :%lf\n”, e.sal);
getch();
}
struct emp update(struct emp e1, int p, double s)
{
e1.points+=p;
e1.sal+=s;
return(e1);
}

8) What is the self referential structures?

Self referential structures : A structure consists of atleast a pointer member pointing to the same structure
is known as a self-referential structure.

Syntax : struct tag_name


{
type member1;s\
type membere2;
: :
: :
typeN memberN;
struct tag_name *name;
}

8
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Where *name refers to the name of a pointer variable.

9) Describe about is the pointers and structures?

Pointers To Structures : we know that a pointer is a variable which contains address of another variable.
A variable which contains address of a structure variable is called pointer to a structure. A pointer to
a structure is created as follows.

Syntax : struct tag_name


{
type1 member1;
type2 member2;
: :
: :
typeN memberN;
};
struct tag_name *pointer_variable;

Ex :
#include<stdio.h>
#include<conio.h>
struct student
{
char name[10];
int rno;
int marks;
}std1;
void main()
{
struct student *pt;
clrscr();
printf("\nEnter the student details:");
printf("\nEnter the student name:");
scanf("%s",std1.name);
printf("\nEnter the rno:");
scanf("%d",&std1.rno);
printf("\nEnter the marks:");
scanf("%d",&std1.marks);
pt=&std1;
printf("\n Display of structure using structure variable");
printf("\nRollNo\tName\tMarks");
printf("\n%s\t%d\t%d",std1.name,std1.rno,std1.marks);
printf("\nDisplay of structure using pointer variable");
printf("\nRollNo\tName\tMarks");
printf("\n%s\t%d\t%d",pt->name,pt->rno,pt->marks);
getch();
9
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
}

10) What is the type definition? (OR)


Explain typedef keyword?

Typedef Declaration : The typedef is a keyword that allows the programmer to create a new data type
name for an existing data type. So, the purpose of typedef is to redefine the name of an existing variable type.

Syntax : typedef data_type newname1,new name2,…new nameN;

Where

1 : typedef : is a keyword.
2 : data type : any Existing Data Type.
3 : New Names for the existing Data Type.

Ex : typedef int MARKS;


MARKS sub1,sub2,sub3;

Advantages of typedef :

1 : Provides a meaningful way of declaring the variable.


2 : Increase the readability of the program.

#include<stdio.h>
#include<conio.h>
void main()
{
typedef int digits;
digits a,b,sum;
clrscr();
printf("Enter a and b values:");
scanf("%d%d",&a,&b);
sum=a+b;
printf("The sum is:%d",sum);
getch();
}

11) What is enumerated types? (OR)


Define enum keyword?
Enumerated Types : An enumerated data type is a user defined data type which can take the integer values
from a list. These integer values are replaced by meaningful and descriptive names to enhance the readability of
the program. These descriptive names rise to new data type called enumerated data type.

10
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

For Example : we can take integers 1, 2, 3, ……12 to represent months for easy programming. It is more
readable and understandable if we replace these numbers by some meaningful and descriptive names such as
jan, feb, mar,…Dec. This concept of replacing integers by some meaningful and descriptive names gives rise to
new data type called enumerated data type.

Syntax : enum tag_name


{
member1;
member2;
:
memberN;
};

Declaration of variable

enum tag_name variables;

Example 1 :
#include<stdio.h>
#include<conio.h> OUTPUT : 2
void main()
{
enum months
{
jan,feb,mar,apr,may,jun,july,aug,sep,oct,nov,dec
};
clrscr();
printf("%d",mar);
getch();
}

Example 2 :

#include<stdio.h>
#include<conio.h> OUTPUT :
void main() Monday is : 1
{
enum days
{
sun,mon,tue,wed,thu,fri,sat
}d1,d2;
clrscr();
d1=sun;
printf("Monday is:%d",d1+1);
getch();

11
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

12) What are the bit-fields?

BitFields : The bit field is a special feature available in C language. Which is normally is used to manipulate
the bits. A group of several bits can be packed together using a structure. Since bit fields are defined within a
structure or union, the various bits can be accessed in a way we acess individual members of a structure or unin.

Syntax : struct tag_name


{
data_type identifier1:bit_length;
data_type identifier2:bit_length;
:
:
data_type identifierN:bit_length;
};
Where,

data_type : is of type int or unsigned int.


identifier1,identifier2…identifierN are the names of the bit_fields.
bit_length is the number of bits used for the identifiers.

The various restrictions in using the bit fields are

1 : Address of a bitfield cannot be accessed.


2 : Pointers cannot be used to acess bitfields.
3 : Bit fields cannot be declared as static.
4 : No field can be longer than 32 bits ( 1 long word).
5 : it is not possible to declare arrays of bit fields.
6 : The ampersand (&) cannot be applied to fields, so there cannot be pointers to bit fields. Hence, we cannot
use scanf to read values into bit fields.
#include<stdio.h>
#include<conio.h>
void main()
{
struct student
{
char name[10];
unsigned age:5;
unsigned rollno:8;
char branch[10];
};
struct student s[5];
int n,i,age,rollno;

12
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
clrscr();
printf("Enter the number of students\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter the information of student =%d\n",i+1);
printf("Name :");
scanf("%s",s[i].name);
printf("Age :");
scanf("%d",&age);
printf("RollNo :");
scanf("%d",&rollno);
printf("Branch :");
scanf("%s",s[i].branch);
s[i].age=age;
s[i].rollno=rollno;
}
printf("Name\t Age\t RollNo\t Branch\n");
for(i=0;i<n;i++)
{
printf("%s\t\%d\t%d\t%s\n",s[i].name,s[i].age,s[i].rollno,s[i].branch);
}
getch();
}

13) What is union?

Union : Union is a derived type and it is declared like structure. The difference between union and structure is
in terms of storage. In structure each member has its own storage location, whereas all the members of union
use the same location, although a union may contain many members of different types. When we use union the
compiler allocates a piece of storage that is larger enough to hold. Like structures, union is also declared by
using the keyword union.

Syntax : union union_name


{
type1 member1;
type2 member2;
: :
: :
typeN memberN;
};
Where,

1 : union : is the keyword.

13
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2 : union_name : is the name of union.
3 : member1,member2, ….. , memberN are called members of the structure. They are also called fields of the
structure.
4 : The members are declared within curly braces. The members can be any of the data types such as int, char,
flat, etc.
5 : There should be semicolon at the end of closing brace.

Ex : union student
{
int sno,smarks;
char sname[10];
};

14) Difference between structure and union?

Difference between Structure and union

Structure Union
1 : The keword struct is used to define a 1 : The keyword union is used to define a
structure.y union.
2 : When a variable is associated with a 2 : When a variable is associated with a
structure, the compiler allocates the memory union, the compiler allocates the memory by
for each member. The size of structure is considering the size of the largest member.
greater than or equal to the sum of sizes of its So size of union is equal to the size of largest
members. The smaller members may end number.
with unused slack bytes.
3 : Each member within a structure is 3 : Memory allocated is shared by individual
assigned unique storage area. members of union.
4 : The address of each member will be in 4 : The address is same for all the members of
asecending order. This indicates that memory a union. This indicates that every member
for each member will start at different offset begins at offset values.
values.
5 : Alterning the value of a member will not 5 : Alterning the value of any of the member
affect other members of the structure. will alter other member values.
6 : Individual members can be accessed at a 6 : Only one member can be accessed at a
time. time.
7 : Several members of a structure can be 7 : Only the first member of a unin can be
initialized at once. initialized.

LONG QUESTIONS AND ANSWERS (10M)


------------------------------------------------------------
1) What is the structure? How to decleration, initialiing and accessing of the structure?

14
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Definition of Structures : A Structure is a derived data type. A structure contains one or more data items
of same or different data types in which the individual elements can differ in type. A simple structure may
contain the integer elements, float elements, character elements etc. The individual structure elements are called
members.

The general format is :

struct tag_name
{
type1 member1;
type2 member2;
: :
: :
typeN memberN;
};

Where,
1 : struct : struct is the keyword which tells the compiler that a structure is being defined.
2 : tag_name : is the name of the structure.
3 : member1,member2, ….. , memberN are called members of the structure. They are also called fields of the
structure.
4 : The members are declared within curly braces. The members can be any of the data types such as int, char,
flat, etc.
5 : There should be semicolon at the end of closing brace.

Ex : struct student
{
char name[10];
int roll_number;
float average_marks;
};
The structure definition does not reserve any space in memory for the members. So, it is called a
structure template and memory will not be allocated for the template.

Declaration of Structures : After defining a structure format we can declare variables of that type. A
structure variable declaration is similar to the declaration of variables of any other data types.

The declaration of a structure varaiable has four parts,


1 : struct : is the keyword.
2 : tag_name : is the structure name.
3 : list of varaibels : followed by list of varaiables separated by commas.
4 : Followed by terminating semicolon.

Syntax : struct tag_name list of variables;

15
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Ex : struct student it1,it2;

The complete structure definition along with structure declaration.

struct student
{
char name[10];
int roll_number; //structure definition.
float average_marks;
};
struct student it1,it2; //structure declaration.

Is same as…

struct student
{
char name[10];
int roll_number;
float average_marks;
} it1,it2;

OR even……

struct
{
char name[10];
int roll_number;
float average_marks;
} it1,it2;

Once the structure definition is associated with variables such as it1 and it2, the compiler allocates
memory for the structure variables. The number of bytes allocated for the variable it1 is

- 10 bytes are allocated for the field name


- 2 bytes for the field roll_number.
- 4 bytes for the field average_marks.

So, totally 16 bytes are reserved for the variable it1 and another 16 bytes are reserved for the variable it2.

Initilization of Structures : The initializing structure variable is similar to that of arrays i.e, all the
elements will be enclosed within curly braces i.e, ‘{‘ and ‘}’ and are separated by commas.

Syntax : struct tag_name variable={v1,v2,…vn};

16
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Where,

1 : “struct tag_name” is derived data type.


2 : v1,v2..vn are all the initial values. These values are called initilizers, they should be separated by commas
and should be enclosed between ‘{‘ and ‘}’.

Examples

1 :Initilization along with structure definion.

struct student
{
char name[10];
int roll_number;
float average_marks;

}it1={“jbrec”, 1000, 75};

2 : Initilization during structure declartion.

struct student
{
char name[10];
int roll_number;
float average_marks;
};

struct student it1={“jbrec”, 1000, 75};

3 : Initilization along with structure declaration with more than one variable.

struct student
{
char name[10];
int roll_number;
float average_marks;

} it1,it2={“jbrec”, 1000, 75};

4 : Initilization during structure declaration with more than one variable.

struct student
{
char name[10];
int roll_number;
17
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
float average_marks;

} it1={“jbrec”, 1000, 75}, it2={“jbrec”, 1000, 75};


Initializing both variables it1 and it2 can also be done as

struct student
{
char name[10];
int roll_number;
float average_marks;

};
struct student it1={“jbrec”, 1000, 75};
struct student it2={“jbrec”, 1000, 75};

NOTE : The members of the structure cannot be initilzed in the structure definition.

Accessing Structures : After declaring the structure type, variables and members, the members of the
structure can be accessed by using the structure variable along with dot(.) operator.

Syntax : variable.member;

Ex : struct student
{
char name[10];
int roll_number;
float average_marks;

};
struct student it1;
For accessing the structure members from the

it1.name; it1.roll_number; it1.average_marks;

Where ‘it1’ is the structure variable.

Write a program to print the student number, name and marks through accessing structure elements.

#include<stdio.h>
#include<conio.h>
struct std
{
int no;
char name[10];
int marks;
};

18
JOGINPALLY B. R. ENGINEERING COLLEGE
B.Tech-I Year COMPUTER PROGRAMMING NOTES
D.Murali Mohan K. Praveen Kumar P.Sandya A. Raju
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
struct std s;
void main()
{
float total,avg;
printf("Enter student details:\n");
printf("\nEnter the student no:");
scanf("%d",&s.no);
printf("\nEnter the student name:");
scanf("%s",&s.name);
printf("\nEnter the student marks:");
scanf("%d",&s.marks);
printf("Rollno\tName\tMarksn");
printf("%d\t%s\t%d”,s.no,s.name,s.marks);
getch();

OUTPUT :Enter student details :


Enter the student no :5
Enter the student name :ravi
Enter the student marks :56

Rollno Name Marks


5 ravi 56

19

Вам также может понравиться