Skip to main content

Timeline for My first random password generator

Current License: CC BY-SA 4.0

11 events
when toggle format what by license comment
Oct 3, 2019 at 0:13 comment added Peter Jennings @MooingDuck I never said it was perfect. I like some variation on Ronald's idea of declaring the memory in the calling function (main) and passing a pointer. That should fix it. If this were some full blown password generator you would take user input for the password length, malloc the memory, call this function and free up the memory in the calling function once you have used the password,
Oct 2, 2019 at 23:14 comment added Mooing Duck The suggested code leaks memory
Oct 1, 2019 at 22:25 comment added Peter Jennings @dustytrash I admit that 'n' instead of 'length_of_characters_to_be_used' was a slip of the pen! It should, at least , have been a bit more descriptive. Another reason I've been liberal with the comments is to help the OP, an learner, understand the code.
Oct 1, 2019 at 22:18 comment added Peter Jennings @dustytrash It's a matter of personal preference to some extent. Long variable names are a double edged weapon. Yes they are descriptive, but they can become unwieldy and make lines of code excessively long and awkward to read. My take is to use fairly short but descriptive names and expand on their use in the comments to allay any doubt. As for comments, I'm old school. I've been writing C on and off for over 35 years (Kernighan and Ritchie was my text book) and have always adhered to the idea of commenting most important lines to aid the next guy who needs to edit the code.
Oct 1, 2019 at 22:01 history edited Peter Jennings CC BY-SA 4.0
added 14 characters in body
Oct 1, 2019 at 15:39 comment added dustytrash Instead of commenting the description of a variable, why not use descriptive names? The compiler does not care if the varaible has a long name like alphanumerics_plus_special_characters or length_of_characters_to_be_used.
Oct 1, 2019 at 14:42 history edited Peter Jennings CC BY-SA 4.0
Add code example
Oct 1, 2019 at 10:46 history edited Toby Speight CC BY-SA 4.0
Use real list; `bool` typedef requires `<stdbool.h>` unconditionally.
Oct 1, 2019 at 10:12 history edited Peter Jennings CC BY-SA 4.0
correct typop
Oct 1, 2019 at 1:05 review First posts
Oct 1, 2019 at 1:16
Oct 1, 2019 at 1:01 history answered Peter Jennings CC BY-SA 4.0