/*
 CSCI 235 lab
 */

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

/* magic union goes here */

int main(int argc, char** argv) {
  float floatyNumIn ;
  uint32_t floatyBits ;
  union overlap32 floatyUnion ;

  puts("Enter floating point number:") ;
  scanf("%f", &floatyNumIn) ;
  printf("As float:  %f\n", floatyNumIn) ;

  /* type punning */
  floatyBits = 0u ;
  /* magic goes here */
  puts("Type punning") ;
  printf("Float bits:   %08X\n", floatyBits) ;

  /* memory copy */
  floatyBits = 0u ;
  /* magic goes here */
  puts("Memory copy") ;
  printf("Float bits:   %08X\n", floatyBits) ;

  /* union hack */
  floatyUnion.bits = 0u ;
  /* magic goes here */
  puts("Union hack") ;
  printf("Float bits:   %08X\n", floatyUnion.bits) ;

  return (EXIT_SUCCESS);
}
