C - Library functions - Using free()

The free() function is the sister of the malloc() function. As malloc() returns the address of the first byte of the allocated memory, free() accepts, as only parameter, the address of this first byte.

** Made by BadproG

#include	<stdlib.h>
#include	<stdio.h>

int     main()
  char	*myString;

  myString = malloc(sizeof(myString));
  if (myString == NULL)
      printf("Can not malloc(), not enough space in the memory!\n");
      printf("OK memory is allocated!\n");
  return (0);

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.