Roman numerals/Encode: Difference between revisions

Line 1,545:
 
=={{header|C}}==
===Naive solution===
 
This solution is a smart but does not return the number written as a string.
<lang c>#include <stdio.h>
 
Line 1,551 ⟶ 1,552:
int main() {
int arabic[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
 
// There is a bug: "XL\0" is translated into sequence 58 4C 00 00, i.e. it is 4-bytes long...
// Should be "XL" without \0 etc.
//
char roman[13][3] = {"M\0", "CM\0", "D\0", "CD\0", "C\0", "XC\0", "L\0", "XL\0", "X\0", "IX\0", "V\0", "IV\0", "I\0"};
int N;