We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a919731 commit f1211b9Copy full SHA for f1211b9
demo/main.c
@@ -7,18 +7,20 @@ void ndraw(mp_int *a, const char *name)
7
{
8
char *buf;
9
int size;
10
+ size_t length[0];
11
12
mp_radix_size(a, 10, &size);
- buf = (char *)malloc((size_t) size);
13
+ *length = (size_t)size;
14
+ buf = (char *)malloc(*length);
15
if (buf == NULL) {
16
fprintf(stderr, "\nndraw: malloc(%d) failed\n", size);
17
exit(EXIT_FAILURE);
18
}
19
20
printf("%s: ", name);
- mp_to_decimal(a, buf, (size_t) size);
21
+ mp_to_radix(a, buf, length, 10);
22
printf("%s\n", buf);
- mp_to_hex(a, buf, (size_t) size);
23
+ mp_to_radix(a, buf, length, 16);
24
printf("0x%s\n", buf);
25
26
free(buf);
0 commit comments