Largest palindromic number that is the product of two 3-digit positive integers. More...
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | LTOA_BUFFER_SIZE 32 |
The size of the string buffer for the "ltoa" (long to ascii) conversion. | |
Functions | |
int | is_palindromic (const long n) |
Determines if an integer is palindromic. | |
void | reverse (char *str) |
Reverses a string in-place. | |
int | main (void) |
Largest palindromic number that is the product of two 3-digit positive integers.
https://projecteuler.net/problem=4
Definition in file 0004.c.
#define LTOA_BUFFER_SIZE 32 |
The size of the string buffer for the "ltoa" (long to ascii) conversion.
The maximum number of digits in a positive long
is D = floor(log10(LONG_MAX)) + 1. The buffer size must be >= D + 2, including the minus sign and a terminating '\0'
.
FIXME: This should not be a fixed size.
int is_palindromic | ( | const long | n | ) |
Determines if an integer is palindromic.
n | An integer >= 0. |
Definition at line 52 of file 0004.c.
int main | ( | void | ) |
Definition at line 23 of file 0004.c.
void reverse | ( | char * | str | ) |
Reverses a string in-place.
Definition at line 78 of file 0004.c.