Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
|
Problem 13 solution More...
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Functions | |
int | get_number (FILE *fp, char *buffer, uint8_t *out_int) |
Function to read the number from a file and store it in array. More... | |
int | add_numbers (uint8_t *a, uint8_t *b, uint8_t N) |
Function to add arbitrary length decimal integers stored in an array. More... | |
int | print_number (uint8_t *number, uint8_t N, int8_t num_digits_to_print) |
Function to print a long number. More... | |
int | main (void) |
Main function. More... | |
Problem 13 solution
int add_numbers | ( | uint8_t * | a, |
uint8_t * | b, | ||
uint8_t | N | ||
) |
Function to add arbitrary length decimal integers stored in an array.
a + b = c = new b
int get_number | ( | FILE * | fp, |
char * | buffer, | ||
uint8_t * | out_int | ||
) |
Function to read the number from a file and store it in array.
index 0 of output buffer => units place
index 1 of output buffer => tens place and so on i.e., index i => 10^i th place
int main | ( | void | ) |
Main function.
int print_number | ( | uint8_t * | number, |
uint8_t | N, | ||
int8_t | num_digits_to_print | ||
) |
Function to print a long number.