icp/oer/courses/c-newcomers/sections/01-introduction/01-programming/content.md

1.7 KiB

The first thing you probably want to know is: What is programming? A program tells the computer what to do. It is like writing a recipe: You give the computer instructions to follow and the computer just executes them in order to get the result. Remember: The computer doesn't know what you try to achieve. It just does, what you tell him.

Description of the online learning platform (2)

Below this text you see a text editor. The editor contains the program, i.e., the code to execute by the computer. In each exercise, we provide a basic skeleton for you to change and play with. Now it contains your very first program.

Below the editor are three buttons, Execute will tell the system to run your instructions and will output the results below. Submit results tells the system to check if your program is correct. Once the results were submitted correctly, you can press the Continue button.

Knowledge

The source code is just some special text, which will get translated into executable code. The line int main() in Line 3 tells the PC where your program starts. Everything between the curly braces between Line 5 and 6 will be executed. Everything behind two slashes "//" is a comment and will be ignored by the computer. Thus, Line 5 will not cause any action by the computer.

Task

For now the only instruction that will be executed is the line printf("Hello NAME"); This is a instruction to write the text between the quotes to the console, here "Hello Name". Use the execute button to execute the code, do you see the output? Then try the submit solution button to check the result: The provided code must be changed to be correct. Change the program, such that it will display instead of NAME your actual name to greet you properly.