C/C++

The Setup

Linux

Mac OSX

Windows

VirtualBox

VirtualBox allows you to run an entire operating system inside another operating system. We can run Ubuntu in host Windows/Mac using VirtualBox.

Installation Process

First Program

Setup

First we need to make sure that we have the setup for compilation and build.

Editor

Fiest of all, we are not going to use any fancy IDE. You can choose any text editor. Here are some of the options: Here, we are going to use Vim. [Tutorial for Vim.]

Install Vim

First C Program

Let us write our first program in C. Let us name the file hello.c.

  #include 

  /* This is a comment. */
  int main(int argc, char *argv[])
  {
      // this is another comment
      printf("Hello World");

      return 0;
  }
Command

Compile and Run

Using gcc

You can also use gcc command instead of make program to compile and build the program. In fact make program uses gcc to compile C programs.

Compiling Single Source C Program

Running Executable