icp/oer/courses/c-basics/sections/01-introduction/01-c-hello/content.html

25 lines
1.7 KiB
HTML

<p>
Welcome to the first lecture. This is what you will see most of the time.
A text in the beginning, explaining all the things you need to know for the lecture and what you have to do,
then a text-editor, where you supposed to edit the code to complete the given task and three buttons below the editor. The execute Button will compile
and execute your code, the submit button will do the same and also check, if your solution is correct. If your solution was correct, you can press the
continue button to go to the next lecture.
</p>
<p>
Now back to the lecture. This is probably the most simple program. That is why you find it in almost any basic programming book or tutorial.
Ignore for now the <code>#include &lt;stdio.h&gt;</code>. It is not important for now. Below that you see the <b>main-function</b>.
It marks the <b>entriepoint for your program</b>.
From there on the computer will exactly <b>execute</b> what you write <b>in order</b> (with exceptions we won't go into). That is what is commonly know as <b>imperative programming</b>.
</p>
<p>
The first thing in our program is a comment and is initiated by double slashes "//". Everything after that in the same line will be ignored by the compiler and therefore not be executed.
For longer comments you can also surround it by "/* */" so you don't have to type double slashes in every line.
</p>
<p>
So now to the exciting part. The line:</br>
<code> printf("Hello User!"); </code></br>
will write text to the console. In this case <it>Hello User!</it>. Every statement in C ends with a semicolon ";".
Your task will be to experiment with that line. Change the program to print out Hello World!.
</p>