Made with ScholarlyMake flashcards like these from your own notes
Question:Lecture 02: CCC101 Computer Programming 1
Answer:Jennifer Joyce M. Montemayor - Department of Computer Science, College of Computer Studies, MSU Iligan Institute of Technology
Question:Jennifer Joyce M. Montemayor - CCC101 Lecture 02
Answer:Your First Program #include int main() { printf("Hello, World!\n"); return 0; }
Question:#include
Answer:This includes a file called stdio.h which allows us to use certain commands. stdio is short for Standard Input Output, which means it has commands for input like reading from the keyboard and output like printing things on the screen.
Question:main function
Answer:main is a function called by the operating system when the program is executed. It is the entry point of every program. The word 'main' is followed by a pair of round brackets. All C programs must have a main function.
Question:Curly Brackets
Answer:A pair of curly brackets are used to group all the commands together so it is known that the set of commands inside the braces belong to the function 'main'. They are used very often in C to group commands together.
Question:printf() function
Answer:printf is the command used to display and print text to the screen. The data to be printed is put inside the round brackets. The command ends with a semicolon.
Question:return 0;
Answer:return 0 sends an exit signal/status to the operating system. It indicates that the end of the program has been reached. The command ends with a semicolon.
Question:Comments
Answer:Comments serve as inline documentation and provide supplementary information to better understand a program. They are ignored by the preprocessor directive and compiler. Comments can run to the end of the line or across line breaks.
Question:White Space
Answer:White space, including spaces, blank lines, and tabs, is used to separate words and symbols in a program. Extra white space is ignored by the compiler. Programs should be formatted to enhance readability, for example, using proper and consistent indentation.
Question:Code Formatting
Answer:The code is valid, but hard to read. Proper formatting and indentation enhance the readability of the program.
Question:Proper and consistent indentation
Answer:Ensuring that each line of code is indented by the same amount to improve readability.
Question:Syntax rules
Answer:The rules of a programming language that dictate how symbols, reserved words, and identifiers can be put together to form a valid program.
Question:Semantics
Answer:The meaning or purpose of a program statement, defining what a statement means and the role it plays in the program.
Question:Readability
Answer:The quality of code that makes it easy to understand, maintain, and modify.