C-Playground/main.c

56 lines
1.6 KiB
C
Executable File

#include <stdio.h>
#include <stdint.h>
#include "lib/temperature.h"
#include "lib/array.h"
#include "lib/base10.h"
// #include "lib/math.h"
#include "lib/alloc.h"
#include "lib/bmp.h"
void swap_int(int *pX, int *pY) {
int temp = *pX;
*pX = *pY;
*pY = temp;
}
int main() {
// intArray unsorted_array;
// int unsorted_array_data[] = { 1, 5, 2, 1, 4, 8, 3, 2, 6, 7 };
// unsorted_array.length = sizeof(unsorted_array_data) / sizeof(int);
// unsorted_array.data = unsorted_array_data;
// intArray sorted_array;
// int sorted_array_data[] = { 1, 2, 4, 8, 9, 9, 9 };
// sorted_array.length = sizeof(sorted_array_data) / sizeof(int);
// sorted_array.data = sorted_array_data;
//
// printf("Unsorted Array : ");
// print_intArray(&unsorted_array);
// printf("Unsorted Array Sorted?: %d\n", check_intArray_sorted(&unsorted_array));
// printf("Sorted Array : ");
// print_intArray(&sorted_array);
// printf("Sorted Array Sorted?: %d\n", check_intArray_sorted(&sorted_array));
//
// printf("40C == %dF\n", (int) celsius_to_farenheit(40.0));
const bitmap test = init_bitmap(2, 2);
bitmap_file test_file = write_to_bitmap(&test, "test.bmp");
bitmap_pixel_color test_pixel;
test_pixel.red = 0;
test_pixel.green = 0;
test_pixel.blue = 0;
bitmap_pixel_color test_pixel2;
test_pixel2.red = 0;
test_pixel2.green = 0;
test_pixel2.blue = 255;
write_bitmap_pixel(&test_file, &test_pixel, 1, 2);
write_bitmap_pixel(&test_file, &test_pixel2, 2, 2);
char *reserved_memory = ss_alloc(100);
ss_alloc_free(reserved_memory);
printf("Memory : %d/%d", ALLOC_SIZE, (int)ss_alloc_get_used_bytes());
}