1/11
Flashcards for Week 5 Session 2 lecture on Programming Tasks and Coding Guidelines.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
argc
An int representing the number of arguments passed to a C program from the command line.
argv
An array of strings containing the arguments passed to a C program from the command line.
atoi()
A function from
atof()
A function from
Coding Style Guidelines
General recommendations for producing well-written and correctly functioning code, including comments, naming, brackets, indentation, whitespace, and consistency.
Comments in C (/* … */)
Used for detailed explanations, generally at the top of a block of code or function.
Comments in C (//)
Used inline for explanation of a specific operation.
Comments in Python (#)
Used inline for explanation of a specific operation.
Python docstrings
Allow embedding documentation in code for explanation at module, class, and function level, read and returned via the help() function.
Indentation (Recommended)
Using 4 spaces for indentation improves code readability. Python enforces indentation. C relies on the developer.
Whitespace
Using spaces and clear lines to improve code readability without affecting compilation or interpretation.
Consistency
Adopting a consistent style for comments, brackets, indentation, and spacing significantly improves code readability.