About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Unit-5 Enumerated, Structure and Union

Structure:

Structure is the collection of variables of different types under a single name for better handling. For example: You want to store the information about person about his/her name, citizenship number and salary. You can create these information separately but, better approach will be collection of these information under single name because all these information are related to person.

Structure Definition in C

Keyword struct is used for creating a structure.

Syntax of structure

struct structure_name 
{
    data_type member1;
    data_type member2;
    .
    .
    data_type memeber;
};

We can create the structure for a person as mentioned above as:
struct person
{
    char name[50];
    int cit_no;
    float salary;
};
This declaration above creates the derived data type struct person.

Structure variable declaration

When a structure is defined, it creates a user-defined type but, no storage is allocated. For the above structure of person, variable can be declared as:

struct person
{
    char name[50];
    int cit_no;
    float salary;
};
 
Inside main function:
struct person p1, p2, p[20];
Another way of creating structure variable is:
struct person
{
    char name[50];
    int cit_no;
    float salary;
}p1 ,p2 ,p[20];
In both cases, 2 variables p1, p2 and array p having 20 elements of type struct person are created.

Accessing members of a structure

There are two types of operators used for accessing members of a structure.
1.     Member operator(.)
2.     Structure pointer operator(->) (will be discussed in structure and pointers chapter)
Any member of a structure can be accessed as: structure_variable_name.member_name
Suppose, we want to access salary for variable p2. Then, it can be accessed as:

p2.salary

Example of structure

Write a C program to add two distances entered by user. Measurement of distance should be in inch and feet.(Note: 12 inches = 1 foot)


#include 
struct Distance{
    int feet;
    float inch;
}d1,d2,sum;
int main(){
    printf("1st distance\n");
    printf("Enter feet: ");
    scanf("%d",&d1.feet);  /* input of feet for structure variable d1 */
    printf("Enter inch: ");
    scanf("%f",&d1.inch);  /* input of inch for structure variable d1 */
    printf("2nd distance\n");
    printf("Enter feet: ");
    scanf("%d",&d2.feet);  /* input of feet for structure variable d2 */
    printf("Enter inch: ");
    scanf("%f",&d2.inch);  /* input of inch for structure variable d2 */
    sum.feet=d1.feet+d2.feet;
    sum.inch=d1.inch+d2.inch;
    if (sum.inch>12)
    {  //If inch is greater than 12, changing it to feet.
        ++sum.feet;
        sum.inch=sum.inch-12;
    }
    printf("Sum of distances=%d\'-%.1f\"",sum.feet,sum.inch); 
/* printing sum of distance d1 and d2 */
    return 0;
}

Output
1st distance
Enter feet: 12
Enter inch: 7.9
2nd distance
Enter feet: 2
Enter inch: 9.8
Sum of distances= 15'-5.7"

Structures within structures

Structures can be nested within other structures in C programming.

struct complex
{
 int imag_value;
 float real_value;
};
struct number{
   struct complex c1;
   int real;
}n1,n2;

Union:

A union is a special data type available in C that enables you to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. Unions provide an efficient way of using the same memory location for multi-purpose.
Defining a Union
To define a union, you must use the union statement in very similar was as you did while defining structure. The union statement defines a new data type, with more than one member for your program. The format of the union statement is as follows:
union [union tag]
{
   member definition;
   member definition;
   ...
   member definition;
} [one or more union variables]; 
The union tag is optional and each member definition is a normal variable definition, such as int i; or float f; or any other valid variable definition. At the end of the union's definition, before the final semicolon, you can specify one or more union variables but it is optional. Here is the way you would define a union type named Data which has the three members i, f, and str:
union Data
{
   int i;
   float f;
   char  str[20];
} data; 
Now, a variable of Data type can store an integer, a floating-point number, or a string of characters. This means that a single variable ie. same memory location can be used to store multiple types of data. You can use any built-in or user defined data types inside a union based on your requirement.
The memory occupied by a union will be large enough to hold the largest member of the union. For example, in above example Data type will occupy 20 bytes of memory space because this is the maximum space which can be occupied by character string. Following is the example which will display total memory size occupied by the above union:
#include
#include

union Data
{
   int i;
   float f;
   char  str[20];
};

int main( )
{
   union Data data;       

   printf( "Memory size occupied by data : %d\n", sizeof(data));

   return 0;
}
When the above code is compiled and executed, it produces the following result:
Memory size occupied by data : 20
Accessing Union Members
To access any member of a union, we use the member access operator (.). The member access operator is coded as a period between the union variable name and the union member that we wish to access. You would use union keyword to define variables of union type. Following is the example to explain usage of union:
#include
#include

union Data
{
   int i;
   float f;
   char  str[20];
};

int main( )
{
   union Data data;       

   data.i = 10;
   data.f = 220.5;
   strcpy( data.str, "C Programming");

   printf( "data.i : %d\n", data.i);
   printf( "data.f : %f\n", data.f);
   printf( "data.str : %s\n", data.str);

   return 0;
}
When the above code is compiled and executed, it produces the following result:
data.i : 1917853763
data.f : 4122360580327794860452759994368.000000
data.str : C Programming
Here, we can see that values of i and f members of union got corrupted because final value assigned to the variable has occupied the memory location and this is the reason that the value if str member is getting printed very well. Now let's look into the same example once again where we will use one variable at a time which is the main purpose of having union:
#include
#include

union Data
{
   int i;
   float f;
   char  str[20];
};

int main( )
{
   union Data data;       

   data.i = 10;
   printf( "data.i : %d\n", data.i);
  
   data.f = 220.5;
   printf( "data.f : %f\n", data.f);
  
   strcpy( data.str, "C Programming");
   printf( "data.str : %s\n", data.str);

   return 0;
}
When the above code is compiled and executed, it produces the following result:
data.i : 10
data.f : 220.500000
data.str : C Programming
Here, all the members are getting printed very well because one member is being used at a time.

Difference between union and structure
Though unions are similar to structure in so many ways, the difference between them is crucial to understand. This can be demonstrated by this example:
#include
union job {         //defining a union
   char name[32];
   float salary;
   int worker_no;
}u;
struct job1 {
   char name[32];
   float salary;
   int worker_no;
}s;
int main(){
   printf("size of union = %d",sizeof(u));
   printf("\nsize of structure = %d", sizeof(s));
   return 0;
}
Output
size of union = 32
size of structure = 40

There is difference in memory allocation between union and structure as suggested in above example. The amount of memory required to store a structure variables is the sum of memory size of all members. But, the memory required to store a union variable is the memory required for largest element of an union. What difference does it make between structure and union? As you know, all members of structure can be accessed at any time. But, only one member of union can be accessed at a time in case of union and other members will contain garbage value.






File Handling in C

 What is a File?
Abstractly, a file is a collection of bytes stored on a secondary storage device, which is generally a disk of some kind. The collection of bytes may be interpreted, for example, as characters, words, lines, paragraphs and pages from a textual document; fields and records belonging to a database; or pixels from a graphical image. The meaning attached to a particular file is determined entirely by the data structures and operations used by a program to process the file. It is conceivable (and it sometimes happens) that a graphics file will be read and displayed by a program designed to process textual data. The result is that no meaningful output occurs (probably) and this is to be expected. A file is simply a machine decipherable storage media where programs and data are stored for machine usage.
Essentially there are two kinds of files that programmers deal with text files and binary files. These two classes of files will be discussed in the following sections.

ASCII Text files

A text file can be a stream of characters that a computer can process sequentially. It is not only processed sequentially but only in forward direction. For this reason a text file is usually opened for only one kind of operation (reading, writing, or appending) at any given time.
Similarly, since text files only process characters, they can only read or write data one character at a time. (In C Programming Language, Functions are provided that deal with lines of text, but these still essentially process data one character at a time.) A text stream in C is a special kind of file. Depending on the requirements of the operating system, newline characters may be converted to or from carriage-return/linefeed combinations depending on whether data is being written to, or read from, the file. Other character conversions may also occur to satisfy the storage requirements of the operating system. These translations occur transparently and they occur because the programmer has signalled the intention to process a text file.

Binary files

A binary file is no different to a text file. It is a collection of bytes. In C Programming Language a byte and a character are equivalent. Hence a binary file is also referred to as a character stream, but there are two essential differences.
1.  No special processing of the data occurs and each byte of data is transferred to or from the disk unprocessed.
2.  C Programming Language places no constructs on the file, and it may be read from, or written to, in any   
manner chosen by the programmer.

Binary files can be either processed sequentially or,
depending on the needs of the application, they can   
be processed using random access techniques. In C Programming Language, processing a file using random access techniques involves moving the current file position to an appropriate place in the file before reading or writing data. This indicates a second characteristic of
binary files.

They a generally processed using read and write operations simultaneously.

For example, a database file will be created and processed as a binary file. A record update operation will involve locating the appropriate record, reading the record into memory, modifying it in some way, and finally writing the record back to disk at its appropriate location in the file. These kinds of operations are common to many binary files, but are rarely found in applications that process text files.


We frequently use files for storing information which can be processed by our programs. In order to store information permanently and retrieve it  we need to use files.

Files are not only used for data. Our programs are also stored in files.

The editor which you use to enter your program and save it, simply manipulates files for you.

The UNIX commands cat, cp, cmp are all programs which process your files.

In order to use files we have to learn about File I/O i.e. how to write information to a file and how to read information from a file.

We will see that file I/O is almost identical to the terminal I/O that we have being using so far.

The primary difference between manipulating files and doing terminal I/O is that we must specify in our programs which files we wish to use.

As you know, you can have many files on your disk. If you wish to use a file in your programs, then you must specify which file or files you wish to use.

Specifying the file you wish to use is referred to as opening the file.

When you open a file you must also specify what you wish to do with it i.e. Read from the file, Write to the file, or both.

Because you may use a number of different files in your program, you must specify when reading or writing which file you wish to use. This is accomplished by using a variable called a file pointer.

Every file you open has its own file pointer variable. When you wish to write to a file you specify the file by using its file pointer variable.

You declare these file pointer variables as follows:


FILE  *fopen(), *fp1, *fp2, *fp3;


The variables fp1, fp2, fp3 are file pointers. You may use any name you wish.

The file <stdio.h> contains declarations for the Standard I/O library and should always be included at the very beginning of C programs using files.


Constants such as FILE, EOF and NULL are defined in <stdio.h>.

You should note that a file pointer is simply a variable like an integer or character.

It does not point to a file or the data in a file. It is simply used to indicate which file your I/O operation refers to.

A file number is used in the Basic language and a unit number is used in Fortran for the same purpose.

The function fopen is one of the Standard Library functions and returns a file pointer which you use  to refer to the file you have opened e.g.

   fp = fopen( “prog.c”,  “r”) ;

The above statement opens a file called prog.c for reading and associates the file pointer fp with the file.

When we wish to access this file for I/O, we use the file pointer variable fp to refer to it.

You can have up to about 20 files open in your program - you need one file pointer for each file you intend to use.


File I/O

The Standard I/O Library provides similar routines for file I/O to those used  for standard I/O.

The routine getc(fp) is similar to getchar()
and putc(c,fp) is similar to putchar(c).

Thus the statement

   c = getc(fp);

reads the next character from the file referenced by fp and the statement

   putc(c,fp);

writes the character c into file referenced by fp.

// file.c: Display contents of a file on screen 

#include

void main()
{
   FILE *fopen(), *fp;
   int c ;

   fp = fopen( “prog.c”, “r” );
   c = getc( fp ) ;    
   while (  c != EOF )
   {
       putchar( c );       
       c = getc ( fp );  
   }

   fclose( fp );
}

In this program, we open the file prog.c for reading.

We then read a character from the file. This file must exist for this program to work.

If the file is empty, we are at the end, so getc returns EOF a special value to indicate that the end of file has been reached. (Normally -1 is used for EOF)

The while loop simply keeps reading characters from the file and displaying them, until the end of the file is reached.

The function fclose is used to close the file i.e. indicate that we are finished processing this file.

We could reuse the file pointer fp by opening another file.

This program is in effect a special purpose cat command. It displays file contents on the screen, but only for a file called prog.c.

By allowing the user enter a file name, which would be stored in a string, we can modify the above to make it an interactive cat command:

//cat2.c: Prompt user for filename and display file on screen 

#include

void main()
{
   FILE *fopen(), *fp;
   int c ;
   char filename[40] ;

   printf(“Enter file to be displayed: “);
   gets( filename ) ;

   fp = fopen( filename, “r”); 

   c = getc( fp ) ;      

   while (  c != EOF )
   {
       putchar(c);     
       c = getc ( fp );
   }

   fclose( fp );
}


In this program, we pass the name of the file to be opened which is stored in the array called filename, to the fopen function. In general, anywhere a string constant such as “prog,c” can be used so can a character array such as filename. (Note the reverse is not true).

The above programs suffer a major limitation. They do not check whether the files to be used exist or not.

If you attempt to read from an non-existent file, your program will crash!!

The fopen function was designed to cope with this eventuality. It checks if the file can be opened appropriately. If the file cannot be opened, it returns a NULL pointer. Thus by checking the file pointer returned by fopen, you can determine if the file was opened correctly and take appropriate action e.g.

          fp = fopen (filename, “r”) ;

    if ( fp  ==  NULL)
    {
    printf(“Cannot open %s for reading \n”, filename );
         exit(1) ; /*Terminate program: Commit suicide  
                   !!*/
    }

The above code fragment show how a program might check if a file could be opened appropriately.

The function exit() is a special function which terminates your program immediately.

exit(0) mean that you wish to indicate that your program terminated successfully whereas a nonzero value means that your program is terminating due to an error condition.

Alternatively, you could prompt the user to enter the filename again, and try to open it again:

          fp = fopen (fname, “r”) ;

    while ( fp  ==  NULL)
    {
         printf(“Cannot open %s for reading \n”, fname );

         printf(“\n\nEnter filename :” );
         gets( fname );

         fp = fopen (fname, “r”) ;
    }

In this code fragment, we keep reading filenames from the user until a valid existing filename is entered.

Exercise:     Modify the above code fragment to allow the user 3 chances to enter a valid filename. If a valid file name is not entered after 3 chances, terminate the program.

RULE: Always check when opening files, that fopen succeeds in opening the files appropriately.

Obeying this simple rule will save you much heartache.

Example 1: Write a program to count the number of lines and characters in a file.

Note: Each line of input from a file or keyboard will be terminated by the newline character ‘\n’. Thus by counting newlines we know how many lines there are in our input.


/*count.c : Count characters in a file*/

#include

void main()
    /* Prompt user for file and count number of characters
       and lines in it*/
{
    FILE *fopen(), *fp;
    int c , nc, nlines;
    char filename[40] ;

    nlines = 0 ;
    nc = 0;

    printf(“Enter file name: “);
    gets( filename );

    fp = fopen( filename, “r” );    

    if ( fp == NULL )
    {
         printf(“Cannot open %s for reading \n”, filename );
         exit(1);      /* terminate program */
    }

    c = getc( fp ) ;        
    while (  c != EOF )
    {
         if ( c  ==  ‘\n’  )    
             nlines++ ;

         nc++ ; 
         c = getc ( fp );
    }

    fclose( fp );

    if ( nc != 0 )
    {
         printf(“There are %d characters in %s \n”, nc, filename );
         printf(“There are %d lines \n”, nlines );
    }
    else
         printf(“File: %s is empty \n”, filename );
}



/* display.c: File display program */
/* Prompt user for file and display it 20 lines at a time*/

#include

void main()
{
    FILE *fopen(), *fp;
    int c ,  linecount;
    char filename[40], reply[40];

    printf(“Enter file name: “);
    gets( filename );

    fp = fopen( filename, “r” );       /* open for reading */

    if ( fp == NULL )       /* check does file exist etc */
    {
         printf(“Cannot open %s for reading \n”, filename );
         exit();      /* terminate program */
    }

    linecount = 1 ;

    reply[0] = ‘\0’ ;
    c = getc( fp ) ;       /* Read 1st character if any */
    while ( c != EOF &&  reply[0] != ‘Q’ && reply[0] != ‘q’)
    {
         putchar( c ) ;        /* Display character */
         if ( c  ==  ‘\n’  )               
             linecount = linecount+ 1 ;

         if ( linecount == 20 )
         {
             linecount = 1 ; 
             printf(“[Press Return to continue, Q to quit]”);
             gets( reply ) ;
         }
         c = getc ( fp );
    }
    fclose( fp );
}

The string reply will contain the user’s response. The first character of this will be reply[0]. We check if this is ‘q’ or ‘Q’. The brackets [] in printf are used to distinguish the programs message from the file contents. 


/* compare.c : compare two files */

#include
void main() 
{
    FILE *fp1, *fp2, *fopen();
    int ca, cb;
    char fname1[40], fname2[40] ;

    printf(“Enter first filename:”) ;
    gets(fname1);
    printf(“Enter second filename:”);
    gets(fname2);
    fp1 = fopen( fname1,  “r” );       /* open for reading */
    fp2 = fopen( fname2,  “r” ) ;     /* open for writing */   
    if ( fp1 == NULL )      /* check does file exist etc */
    {
         printf(“Cannot open %s for reading \n”, fname1 );
         exit(1);    /* terminate program */
    }
    else if ( fp2 == NULL )
    {
         printf(“Cannot open %s for reading \n”, fname2 );
         exit(1);    /* terminate program */
    }
    else         /* both files opened successfully  */
    {
         ca  =  getc( fp1 ) ;     
         cb  =  getc( fp2 ) ;

         while ( ca != EOF   &&   cb != EOF   &&   ca == cb  )
         {
             ca  =  getc( fp1 ) ;     
             cb  =  getc( fp2 ) ;
         }
         if (  ca == cb )
             printf(“Files are identical \n”);
         else if ( ca !=  cb )
             printf(“Files differ \n” );
         fclose ( fp1 );    
         fclose ( fp2 );
    }
}




Writing to Files

The previous programs have opened files for reading and read characters from them.

To write to a file, the file must be opened for writing e.g.

       fp = fopen( fname, “w” );

If the file does not exist already, it will be created.  If the file does exist, it will be overwritten!  So, be careful when opening files for writing, in case you destroy a file unintentionally. Opening files for writing can also fail. If you try to create a file in another users directory where you do not have access you will not be allowed and fopen will fail.

Character Output to Files
The function putc( c, fp ) writes a character to the file associated with the file pointer fp.

Example:Write a file copy program which copies the file “prog.c” to “prog.old”

Outline solution:

    Open files appropriately
    Check open succeeded
    Read characters from prog.c and
    Write characters to prog.old until all characters   copied

    Close files


The step: “Read characters .... and write ..” may be refined to:

   read character from prog.c
   while not end of file do
   begin
       write character to prog.old
       read next character from prog.c
   end
  

/* filecopy.c : Copy prog.c to prog.old */

#include
void main() 
{
    FILE *fp1, *fp2, *fopen();
    int c ;

    fp1 = fopen( “prog.c”,  “r” );       /* open for reading */
    fp2 = fopen( “prog.old”, “w” ) ; ../* open for writing */   

    if ( fp1 == NULL )/* check does file exist etc */
    {
       printf(“Cannot open prog.c for reading \n” );
       exit(1);    /* terminate program */
    }
    else if ( fp2 == NULL )
    {
       printf(“Cannot open prog.old for writing \n”);
       exit(1);    /* terminate program */
    }
    else       /* both files O.K. */
    {
       c = getc(fp1) ;      
       while ( c != EOF)
       {
           putc( c,  fp2);    /* copy to prog.old */
           c =  getc( fp1 ) ;
       }

    fclose ( fp1 );       /* Now close files */
    fclose ( fp2 );
    printf(“Files successfully copied \n”);
    }
}


The above program only copies the specific file prog.c to the file prog.old. We can make it a general purpose program by prompting the user for the files to be copied and opening them appropriately.

/* copy.c : Copy any user file*/

#include
void main() 
{
    FILE *fp1, *fp2, *fopen();
    int c ;
    char fname1[40], fname2[40] ;

    printf(“Enter source file:”) ;
    gets(fname1);

    printf(“Enter destination file:”);
    gets(fname2);

    fp1 = fopen( fname1,  “r” );       /* open for reading */
    fp2 = fopen( fname2, “w” ) ; ../* open for writing */   

    if ( fp1 == NULL )      /* check does file exist etc */
    {
         printf(“Cannot open %s for reading \n”, fname1 );
         exit(1);    /* terminate program */
    }
    else if ( fp2 == NULL )
    {
         printf(“Cannot open %s for writing \n”, fname2 );
         exit(1);    /* terminate program */
    }
    else         /* both files O.K. */
    {
         c = getc(fp1) ;       /* read from source */
         while ( c != EOF)
         {
             putc( c,  fp2);    /* copy to destination */
             c =  getc( fp1 ) ;
         }

    fclose ( fp1 );       /* Now close files */
    fclose ( fp2 );
    printf(“Files successfully copied \n”);
    }
}


/*
 Program    :- Write a program to read data from
keyboard, write it to a file named STUDENT again read the same data from STUDENT file and write it into DATA file. Same data should be displayed on the screen.

*/


#include
#include
#include
struct stud
{
 int rno;
 char *nm;
};
void main()
{
 struct stud *s;
 int n,i;
 FILE *fp,*fp1;
 clrscr();
 printf("Enter how many record you want to input : ");
 scanf("%d",&n);
 s=(struct stud *)malloc(n*sizeof(struct stud));
 fp=fopen("STUD.txt","w");
 for(i=0;i
 {
  printf("\n\tInformation for student : %d\n",i+1);
  printf("Enter 
Roll No : ");
  scanf("%d",&s[i].rno);
  printf("Enter Name : ");
  fflush(stdin);
  gets(s[i].nm);
  fprintf(fp,"%5d  %-20s\n",s[i].rno,s[i].nm);
 }
 fclose(fp);
 fp=fopen("STUD.txt","r");
 fp1=fopen("DATA.txt","w");
 printf("\nContent of the STUD.
txt file is\n");
 printf("Roll No   Name\n");
 printf("---------------------------\n");
 while(!feof(fp))
 {
  fscanf(fp,"%5d  %20s\n",&s[i].rno,s[i].nm);
  fprintf(fp1,"%5d  %-20s\n",s[i].rno,s[i].nm);
  printf("%7d   %-20s\n",s[i].rno,s[i].nm);       }
 fcloseall();
 getch();
}


/*
Output:

Enter how many record you want to input : 3

 Information for student : 1
Enter Roll No : 1
Enter Name : Diz

 Information for student : 2
Enter Roll No : 2
Enter Name : Umesh

 Information for student : 3
Enter Roll No : 3
Enter Name : Mehul

Content of the STUD.txt file is
Roll No   Name
---------------------------
      1   Diz
      2   Umesh
      3   Mehul
*/

Formatted I/O:


Drawbacks of Traditional I/O System

1.       Until now we are using Console Oriented I/O functions.
2.      “Console Application” means an application that has a text-based interface. (black screen window))
3.      Most applications require a large amount of data , if this data is entered through console then it will be quite time consuming task
4.      Main drawback of using Traditional I/O :- data is temporary (and will not be available during re-execution )





Consider example -
1.       We have written C Program to accept person detail from user and we are going to print these details back to the screen.
2.      Now consider another scenario , suppose we want to print same data that we have entered previously.
3.      We cannot save data which was entered on the console before.
4.      Now we are storing data entered (during first run) into text fileand when we need this data back (during 2nd run) , we are going to read file.

Introduction to file handling in C :

1.       New way of dealing with data is file handling.
2.      Data is stored onto the disk and can be retrieve whenever require.
3.      Output of the program may be stored onto the disk
4.      In C we have many functions that deals with file handling
5.      A file is a collection of bytes stored on a secondary storage device(generally a disk)
6.      Collection of byte may be interpreted as -
o    Single character
o    Single Word
o    Single Line
o    Complete Structure.




Difference Between Structure and Union :

Structure
Union
i. Access Members     
We can access all the members of structure at anytime.
Only one member of union can be accessed at anytime.
ii. Memory Allocation     
Memory is allocated for all variables.
Allocates memory for variable which variable require more memory.
iii. Initialization     
All members of structure can be initialized
Only the first member of a union can be initialized.
iv. Keyword     
'struct' keyword is used to declare structure.
'union' keyword is used to declare union.
v. Syntax     
struct struct_name
{
    structure element 1;
    structure element 2;
        ----------
        ----------
    structure element n;
}struct_var_nm;
union union_name
{
    union element 1;
    union element 2;
        ----------
        ----------
    union element n;
}union_var_nm;
vi. Example     
struct item_mst
{
    int rno;
    char nm[50];
}it;





union item_mst
{
    int rno;
    char nm[50];
}it;


No comments: