Duplicate
Export
Register
CCC101(2-3)
1 Flashcard Deck
Send to Chat
AI Edit
Heading 3
Highlight
Here's your flashcard deck!
Send to Chat
AI Edit
Normal Text
Highlight
You can edit it by clicking the 'edit'! Once you have a few cards, you can begin to study it in full screen or use our AI study mode!
Flashcard Deck
Study
Lecture 02: CCC101 Computer Programming 1
Jennifer Joyce M. Montemayor - Department of Computer Science, College of Computer Studies, MSU Iligan Institute of Technology
Jennifer Joyce M. Montemayor - CCC101 Lecture 02
Your First Program #include<stdio.h> int main() { printf("Hello, World!\n"); return 0; }
#include<stdio.h>
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.
main function
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.
Curly Brackets
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.
printf() function
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.
return 0;
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.
Comments
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.
White Space
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.
Code Formatting
The code is valid, but hard to read. Proper formatting and indentation enhance the readability of the program.
Proper and consistent indentation
Ensuring that each line of code is indented by the same amount to improve readability.
Syntax rules
The rules of a programming language that dictate how symbols, reserved words, and identifiers can be put together to form a valid program.
Semantics
The meaning or purpose of a program statement, defining what a statement means and the role it plays in the program.
Readability
The quality of code that makes it easy to understand, maintain, and modify.
Send to Chat
AI Edit
Normal Text
Highlight
Continue adding your notes here.
Scholarly Assistant's Insights
Learn basic concepts of C programming including functions, syntax, and code formatting.
Computer Programming
C Programming
Programming Languages
Coding
Syntax Rules
+3 more
Ask Scholarly Assistant
Similar Pages
Login to Leave a Comment
Give your feedback, or leave a comment on a page to share your thoughts with the community.
Login