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>
Macros | |
#define | N 10 |
number of digits of the large number | |
#define | N2 (N + 10) |
number of digits in output number | |
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 arbitraty 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. | |
int | main (void) |
Main function. | |
Problem 13 solution
int add_numbers | ( | uint8_t * | a, |
uint8_t * | b, | ||
uint8_t | N | ||
) |
Function to add arbitraty 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