Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Essentials of C Program | Introduction to C
C Basics

bookEssentials of C Program

You've explored the main components of a C program's structure, but there's so much more beneath the surface.

Main.c

Main.c

copy
12345678
#include <stdio.h> // Preprocessor directive int main() { // Entry point printf("Hello, c<>definity!\n"); return 0; // Exit }

The printf() is a function that displays output on the screen. Text meant for display should be wrapped in double quotes.

Note
Definition

A function is a reusable block of code that performs a specific task. It takes input (optional), processes it, and can return a result (optional).

Escape Characters

Escape characters are special sequences in C that start with a backslash (\) and represent non-printable or special characters within strings. They allow you to format text in ways that can't be done with regular characters

Formatting and Spacing
expand arrow
  • \n: newline;
  • \t: horizontal tab;
  • \v: vertical tab;
  • \f: form feed.
Text and Symbol Representation
expand arrow
  • \\: backslash;
  • \': single quote;
  • \": double quote.
Control and System Signals
expand arrow
  • \r: carriage return;
  • \b: backspace;
  • \a: alert (bell);
  • \0: null character.
Main.c

Main.c

copy
12345678
#include <stdio.h> int main() { printf("Hel\nlo"); return 0; }

The Semicolon

The semicolon ; signifies the end of a statement in C. Every statement in C should conclude with a ;. Think of it like the period at the end of a written sentence.

The Return Statement

The return is statement that used to end a function and potentially return a value. In the context of the main function, the standard in C requires the use of return 0. It generally indicates an Exit status or the successful termination of a program.

question mark

Which of the following statements about the structure and behavior of a simple C program is correct?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 2

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Awesome!

Completion rate improved to 2.63

bookEssentials of C Program

Sveip for å vise menyen

You've explored the main components of a C program's structure, but there's so much more beneath the surface.

Main.c

Main.c

copy
12345678
#include <stdio.h> // Preprocessor directive int main() { // Entry point printf("Hello, c<>definity!\n"); return 0; // Exit }

The printf() is a function that displays output on the screen. Text meant for display should be wrapped in double quotes.

Note
Definition

A function is a reusable block of code that performs a specific task. It takes input (optional), processes it, and can return a result (optional).

Escape Characters

Escape characters are special sequences in C that start with a backslash (\) and represent non-printable or special characters within strings. They allow you to format text in ways that can't be done with regular characters

Formatting and Spacing
expand arrow
  • \n: newline;
  • \t: horizontal tab;
  • \v: vertical tab;
  • \f: form feed.
Text and Symbol Representation
expand arrow
  • \\: backslash;
  • \': single quote;
  • \": double quote.
Control and System Signals
expand arrow
  • \r: carriage return;
  • \b: backspace;
  • \a: alert (bell);
  • \0: null character.
Main.c

Main.c

copy
12345678
#include <stdio.h> int main() { printf("Hel\nlo"); return 0; }

The Semicolon

The semicolon ; signifies the end of a statement in C. Every statement in C should conclude with a ;. Think of it like the period at the end of a written sentence.

The Return Statement

The return is statement that used to end a function and potentially return a value. In the context of the main function, the standard in C requires the use of return 0. It generally indicates an Exit status or the successful termination of a program.

question mark

Which of the following statements about the structure and behavior of a simple C program is correct?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 2
some-alt