100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4,6 TrustPilot
logo-home
Samenvatting

Summary data types and file & file handling

Beoordeling
-
Verkocht
-
Pagina's
13
Geüpload op
18-01-2026
Geschreven in
2025/2026

This document contains all the key concepts of data types and file handlings

Instelling
Vak









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
Studie
Onbekend
Vak

Documentinformatie

Geüpload op
18 januari 2026
Aantal pagina's
13
Geschreven in
2025/2026
Type
Samenvatting

Onderwerpen

Voorbeeld van de inhoud

UNIT V
USER DEFINED DATA TYPES & FILE HANDLING
Syllabus:
User-defined data types: Structure and Union, Dynamic memory allocation.
Introduction to file concepts, File handling operations.
User-Defined Data Types
User-defined data types allow programmers to define their own data types to store
heterogeneous data efficiently.
Types of User-Defined Data Types
Structure (struct)
Union (union)
Enumeration (enum)
Typedef (typedef)
Structure
Definition
A structure is a collection of variables of different data types grouped under a
single name.
Syntax
struct structure_name {
data_type member1;
data_type member2;
};
Example
struct Employee {
int id;
char name[20];
float salary;
};
Declaration of Structure Variables:
struct Employee e1, e2;
Accessing Structure Members:
e1.id = 101;
printf("%d", e1.id);
Initialization:
Structure initialization means assigning values to structure members at the time of
declaration.
It helps in setting initial values easily and improves code readability.

, struct Student {
int roll;
char name[20];
float marks;
};
struct Student s1 = {101, "Anil", 85.5};
Structure Input Using scanf():
struct Student {
int roll;
char name[20];
float marks;
};
Void main(){
struct Student s1;
scanf("%d", &s1.roll);
scanf("%s", s1.name);
scanf("%f", &s1.marks);
printf("%d", s1.roll);
printf("%s", s1.name);
printf("%f", s1.marks);
}
Memory Allocation in Structures:
Memory allocation in structures refers to how memory is reserved for structure
variables and their members.
Memory is allocated when a structure variable is declared, not when the structure is
defined.
struct Student
{
int roll;
char name[20];
float marks;
};
struct Student s1;
Memory Allocation
Memory is allocated only when s1 is declared
Total memory = sum of sizes of all members
Example:
int → 4 bytes
char[20] → 20 bytes
float → 4 bytes
Total = 28 bytes
Example program:
€6,65
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten

Maak kennis met de verkoper
Seller avatar
tabassumy

Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
tabassumy
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
Nieuw op Stuvia
Lid sinds
2 weken
Aantal volgers
0
Documenten
17
Laatst verkocht
-

0,0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen