Skip to content

Commit f5bbf02

Browse files
committed
Add 0
1 parent 9a99176 commit f5bbf02

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

more_malloc_free/0-malloc_checked.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "main.h"
2+
3+
/**
4+
* malloc_checked - allocates memory using malloc, exit(98) if it fails
5+
* @b: size of the memory block to be allocated
6+
*
7+
* Return: pointer to the address of the memory block
8+
*/
9+
10+
void *malloc_checked(unsigned int b)
11+
{
12+
void *block;
13+
14+
block = malloc(b);
15+
if (block == NULL)
16+
exit(98);
17+
return (block);
18+
}

more_malloc_free/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LAter!

more_malloc_free/main.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef MAIN_H
2+
#define MAIN_H
3+
4+
void *malloc_checked(unsigned int b);
5+
6+
#endif

0 commit comments

Comments
 (0)