100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4,6 TrustPilot
logo-home
Resumen

Summary data types and file & file handling

Puntuación
-
Vendido
-
Páginas
13
Subido en
18-01-2026
Escrito en
2025/2026

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

Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Estudio
Desconocido
Grado

Información del documento

Subido en
18 de enero de 2026
Número de páginas
13
Escrito en
2025/2026
Tipo
Resumen

Temas

Vista previa del contenido

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:
$7.66
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
tabassumy

Documento también disponible en un lote

Conoce al vendedor

Seller avatar
tabassumy
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
Nuevo en Stuvia
Miembro desde
2 semanas
Número de seguidores
0
Documentos
17
Última venta
-

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes