Attempted to separate the snippets of code to small functions and each set of functions have its own file. Also made some improvements by using pools instead of constantly mallocing space.
This commit is contained in:
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#ifndef IO_H
|
||||
#define IO_H
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
/*
|
||||
* @brief Reads three 128 bit integers from the user with a prompt
|
||||
* @param prompt The message to display to the user before reading input
|
||||
* @param a Pointer to store the first integer
|
||||
* @param b Pointer to store the second integer
|
||||
* @param c Pointer to store the third integer
|
||||
* @return 0 on success, -1 on printf error, -2 on scanf error
|
||||
*/
|
||||
int read_int128_triplet(const char* prompt, int128_t* a, int128_t* b, int128_t* c);
|
||||
|
||||
/*
|
||||
* @brief Converts a string to a 128 bit integer
|
||||
* @param s The string to convert
|
||||
* @return The converted 128 bit integer
|
||||
*/
|
||||
int128_t str_to_int128(const char* s);
|
||||
|
||||
/**
|
||||
* @brief Prints a 128 bit integer
|
||||
* @param n The integer to print
|
||||
*/
|
||||
void print_int128(int128_t n);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user