Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
How to Run the Program? | Introduction
C Basics

How to Run the Program?How to Run the Program?

To transform our code into specific commands for the processor, we need a compiler.

A compiler is a tool that takes your written code and translates it into machine code—essentially a series of 0s and 1s —because that's the language a computer's processor understands. Importantly, the compiler doesn't execute your code; it only translates it.

Note

The compiler processes code sequentially, from top to bottom.

The act of compilation goes through several stages:

  • Preprocessor Operation. At this stage, all #include directives are processed, allowing for the inclusion of external files, libraries, and other necessary elements. Essentially, all required components are integrated into your program;
  • Syntax Error Analysis. If the compiler spots any syntax mistakes within your code, it halts the compilation, highlighting the error for correction;
  • Compilation to Executable File. All components linked with your program are consolidated and translated into an executable file. For instance, on the Windows platform, these files take the ".exe" (executable) extension. Once compiled, you can run this file similarly to how you'd run a computer game or application.

Note

An executable file is simply a series of instructions (machine code) meant for the processor. For context, the phrase "Hello, c<>definity" in machine code might resemble a sequence like:

01001000011001010110110001101100011011110010110000100000011000110011110000111 110011001000110010101100110011010010110111001101001011101000111100100100001

Don't stress! This numeric language is meant for machines, not us!

An error was purposely included to showcase how the compiler functions.

c

Main.c

Errors

Why does the compiler point out an error on the 7th line's 2nd character when there's nothing amiss there? That's precisely the issue. The compiler anticipates seeing a semicolon ; at that spot. But why does it expect the semicolon there and not right after printf("some text")?

c

Main.c

The compiler is forgiving with excess semicolons, so it'll let you slide with multiple ; instances.

What are the steps for compiling?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 1. Розділ 3
course content

Зміст курсу

C Basics

How to Run the Program?How to Run the Program?

To transform our code into specific commands for the processor, we need a compiler.

A compiler is a tool that takes your written code and translates it into machine code—essentially a series of 0s and 1s —because that's the language a computer's processor understands. Importantly, the compiler doesn't execute your code; it only translates it.

Note

The compiler processes code sequentially, from top to bottom.

The act of compilation goes through several stages:

  • Preprocessor Operation. At this stage, all #include directives are processed, allowing for the inclusion of external files, libraries, and other necessary elements. Essentially, all required components are integrated into your program;
  • Syntax Error Analysis. If the compiler spots any syntax mistakes within your code, it halts the compilation, highlighting the error for correction;
  • Compilation to Executable File. All components linked with your program are consolidated and translated into an executable file. For instance, on the Windows platform, these files take the ".exe" (executable) extension. Once compiled, you can run this file similarly to how you'd run a computer game or application.

Note

An executable file is simply a series of instructions (machine code) meant for the processor. For context, the phrase "Hello, c<>definity" in machine code might resemble a sequence like:

01001000011001010110110001101100011011110010110000100000011000110011110000111 110011001000110010101100110011010010110111001101001011101000111100100100001

Don't stress! This numeric language is meant for machines, not us!

An error was purposely included to showcase how the compiler functions.

c

Main.c

Errors

Why does the compiler point out an error on the 7th line's 2nd character when there's nothing amiss there? That's precisely the issue. The compiler anticipates seeing a semicolon ; at that spot. But why does it expect the semicolon there and not right after printf("some text")?

c

Main.c

The compiler is forgiving with excess semicolons, so it'll let you slide with multiple ; instances.

What are the steps for compiling?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 1. Розділ 3
some-alt