Curriculum
Course: C basic
Login

Curriculum

C basic

C Introduction

0/1

C Get Started

0/1

C Comments

0/1

C Constants

0/1

C Operators

0/1

C Break and Continue

0/1

C User Input

0/1

C Memory Address

0/1

C Structures

0/1
Text lesson

C Get Started

Get Started With C

To embark on using C, you’ll require:
– A text editor, such as Notepad, for writing C code.
– A compiler, like GCC, to translate the C code into machine-readable language.

Numerous options exist for both text editors and compilers. In this tutorial, we’ll utilize an Integrated Development Environment (IDE) (refer to the section below).

C Install IDE

An Integrated Development Environment (IDE) serves the dual purpose of editing and compiling code.

Common IDEs like Code::Blocks, Eclipse, and Visual Studio are freely available and proficient in both editing and debugging C code.

Please note that while web-based IDEs can function, their capabilities are restricted.

For this tutorial, we’ll opt for Code::Blocks, a recommended starting point.

You can obtain the latest version of Code::Blocks from http://www.codeblocks.org/. Simply download the mingw-setup.exe file, which installs the text editor along with a compiler.

C Quickstart

To initiate our first C file, launch Code::Blocks and navigate to File > New > Empty File.

Enter the provided C code below and save the file as myfirstprogram.c (File > Save File as):

myfirstprogram.c

#include <stdio.h>

int main() {
  printf(“Hello World!”);
  return 0;
}

If the code appears complex at this stage, don’t worry. We’ll delve into its intricacies in subsequent chapters. For now, concentrate on executing the code.

In Code::Blocks, the interface should resemble the following:

Image

 

Next, navigate to Build > Build and Run to execute the program. The outcome should resemble something like this:

Hello World!

Process returned 0 (0x0) execution time : 0.011 s

Press any key to continue.

Well done! You’ve successfully authored and executed your inaugural C program.

Learning C at code7School

When studying C on code7School.com, leverage our “Try it Yourself” tool, showcasing both the code and its corresponding output.

This feature enhances comprehension of each aspect as you progress.

myfirstprogram.c

Code:

#include <stdio.h>

int main() {
  printf(“Hello World!”);
  return 0;
}

Result:

Hello World!