Timeline for Output / Convert to unary number
Current License: CC BY-SA 4.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 21, 2023 at 12:55 | comment | added | 12431234123412341234123 | I think this answer is more relevant for that: codegolf.meta.stackexchange.com/a/8511/59900 I see that this are the default Input/Output. (if you ask me, the default should only be fully runnable programs). The problem in this question is that allocating the correct amount of memory is already most of the task. When you use a 0-byte as digit, you can even mmap or calloc() enough bytes and set the address one byte after the last digit to 1 (or a different value) and don't have to set any other byte. | |
| Jul 21, 2023 at 12:01 | comment | added | Peter Cordes | @12431234: The caller passes it a pointer to a buffer for it to store the output string in. This is one of a couple normal ways for C functions to produce array output, same for assembly. (Others being to malloc new memory). If the caller passes it a bad pointer, that's a bug in the caller. I looked through Default for Code Golf: Input/Output methods but that linked answer is the only one I found that seems related to whether this is an allowed output method, but I've used it before in many other challenges where the output is an array. | |
| Jul 21, 2023 at 9:46 | comment | added | 12431234123412341234123 | Does it reserve the buffer? If not, from where do you get it? Or will it cause a Segment Fault when you run it? | |
| Jul 21, 2023 at 5:50 | history | answered | Peter Cordes | CC BY-SA 4.0 |