Arranquen sus VMs!

Workshop C

Sisop

Problema

1. Crear varios usr con nombres y edades

2. Calcular el promedio

3. solo si son mayores

Despiece

Despiece

0. Crear un proyecto

Despiece

0. Crear un proyecto

1. Crear un usr

usr

Edad

Nombre

usr

Edad int

Nombre string

string

Despiece

0. Crear un proyecto

1. Crear un usr

Despiece

0. Crear un proyecto

1. Crear un usr de posta

Hagamos limpieza

Su futuro lo va a agradecer

Punto de control

‘Tamo?

Parametros

crear ( );

Parametros

crear ( );

crear ( ){}

Parametros

crear ( );

Parametros

crear ( );

crear ( ){}

Despiece

0. Crear un proyecto

1. Crear un usr

2. Imprimirlo

Interludio

¿Por qué podés hacer eso?

El bendito \0

Despiece

0. Crear un proyecto

1. Crear un usr

2. Imprimirlo

3. Acordarselo

Flow

1. Crear varios usr con nombres y edades

Flow

1. Crear varios usr con nombres y edades

Flow

1. Crear varios usr con nombres y edades

Más de uno

3. Acordarselos

Punto de control

‘Tamo?

Incertidumbre

cuantos?

MALLOC(3)-Linux Programmer's Manual

NAME

malloc, free, calloc, realloc

allocate and free dynamic memory

SYNOPSIS

#include <stdlib.h>

void *malloc(size_t size);

DESCRIPTION

The malloc() function allocates size bytes and returns a pointer to the...

MALLOC(3)-Linux Programmer's Manual

NAME

malloc, free, calloc, realloc

allocate and free dynamic memory

SYNOPSIS

#include <stdlib.h>

void *malloc(size_t size);

DESCRIPTION

The malloc() function allocates size bytes and returns a pointer to the...

MALLOC(3)-Linux Programmer's Manual

NAME

malloc, free, calloc, realloc

allocate and free dynamic memory

SYNOPSIS

#include <stdlib.h>

void *malloc(size_t size);

DESCRIPTION

The malloc() function allocates size bytes and returns a pointer to the...

MALLOC(3)-Linux Programmer's Manual

DESCRIPTION

The malloc() function allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().

The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behavior occurs.

If ptr is NULL, no operation is performed.

The calloc() function allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().

RETURN VALUE

The malloc() and calloc() functions return a pointer to the allocated memory that is suitably aligned for any kind of variable. On error, these functions return NULL. NULL may also be returned by a successful call to malloc() with a size of zero, or by a successful call to...

MALLOC(3)-Linux Programmer's Manual

DESCRIPTION

The malloc() function allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().

The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behavior occurs.

If ptr is NULL, no operation is performed.

The calloc() function allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().

RETURN VALUE

The malloc() and calloc() functions return a pointer to the allocated memory that is suitably aligned for any kind of variable. On error, these functions return NULL. NULL may also be returned by a successful call to malloc() with a size of zero, or by a successful call to...

MALLOC(3)-Linux Programmer's Manual

DESCRIPTION

The malloc() function allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().

The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behavior occurs.

If ptr is NULL, no operation is performed.

The calloc() function allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().

RETURN VALUE

The malloc() and calloc() functions return a pointer to the allocated memory that is suitably aligned for any kind of variable. On error, these functions return NULL. NULL may also be returned by a successful call to malloc() with a size of zero, or by a successful call to...

Incertidumbre

cuantos?

LISTAS!

Continuará

Encapsulamiento

Aplicación parcial

Separación de intereses

Orden superior

No nos olvidemos de PdP/Diseño

Tarea

3. solo si son mayores

Workshop C - Google Slides