//-----------------------------------------------------------------------------
// dynamicMemory.c
//
// program will demonstrate the dynamic use of memory
// it shows very basic usage, not recomanded
// for real applications (errorhandling is missing)
//
// group: group 1,13 study assistant AltiHar
//
// author: Altinger Harald 0630xxx
//
// last change: created all (Altinger Harald)
//-----------------------------------------------------------------------------
//

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

//----------------------------------------------------------------------------- 
/// 
/// The main program. 
///
/// do some basic memory handling
/// 
///  @return int  always zero 
// 
int main()
{
  int *memory = NULL; //define a pointer
  
  memory = malloc(sizeof(int));  //get some memory
  memory[0] = 1;  //access that memory
  
  memory = realloc(memory, sizeof(int) * 2); //append the momory
  memory[1] = 2;
  
  printf("%d\n",memory[0]);
  printf("%d\n",memory[1]);
  
  free(memory);  //free the memory
  
  return 0;
}


