| Post Reply | RetroFed Forum Forum Index » techsupport |
| Author | Message | ||
|---|---|---|---|
printf("%s", name);
piefed.blahaj.zone
akunohana@piefed.blahaj.zoneJoined: 2026-03-30 |
I am just learning arrays and I am experimenting. This one simply won't work. I am trying to have the user define (1) how many elements an int array can hold and (2) what the value of each elements is. The program now outputs random integers. Maybe this isn't even possible, but I'm a complete beginner just playing around for the fun of it. XD
|
||
| 6 Original | |||
Artwork
lemmy.world
artwork@lemmy.worldJoined: 2025-12-03 |
Wonderful day! I am sorry, but considering your quite exquisite name, it feels like you searched for Communities already! I'd definitely recommend the following book, too!: |
||
| 2 | |||
|
Blue_Morpho
lemmy.world
Blue_Morpho@lemmy.world Joined: 2023-11-14 |
As an amateur (I haven't coded pro in 30+ years), I'd say this is a job for malloc(). The memory dynamically allocated from user input can then be used as an array. |
||
| 3 | |||
printf("%s", name);
piefed.blahaj.zone
akunohana@piefed.blahaj.zoneJoined: 2026-03-30 |
Wonderful day! I am sorry, but considering your quite exquisite name, it feels like you searched for Communities already! Yet, feeling your appreciated interest in the marvelous programming language, have you checked out more focused Communities?: - !c_lang@programming.dev - !cpp@programming.dev - !programming@programming.dev I'd definitely recommend the following book, too!: - https://amazon.c...
Thank you for the recommendations! |
||
| 2 | |||
printf("%s", name);
piefed.blahaj.zone
akunohana@piefed.blahaj.zoneJoined: 2026-03-30 |
As an amateur (I haven't coded pro in 30+ years), I'd say this is a job for malloc(). The memory dynamically allocated from user input can then be used as an array.
Thanks! I'll look that up! |
||
| 2 | |||
Hupf
feddit.org
Hupf@feddit.orgJoined: 2024-07-24 |
Also, it's never to early to learn about sanitizing user input. For example, checking if scope is neither too big or too small. See e.g. https://stackoverflow.com/a/14099507 |
||
| 2 | |||
| Post Reply |
Back to top |