Back to basic: Code “Hello world” in C with Raspberry Pi 3

So you all got your new and shiny Raspberry Pi 3, and you can’t figure out how to program it.

Before you dwell into endless digital jungle, here is the most fundamental way to write your first piece of software, to take you back to a nostalgic era when software development was so simple.

  1. Go to command line interpreter terminal. Boot your Pi 3 without logging into the Desktop Environment.
  2. In terminal, go to you home directory: $ cd ~/pi
  3. Create a directory called “myproject”: $ mkdir myproject
  4. Get into your directory: $ cd myproject
  5. Check if you are in the right directory: $ pwd It will show /home/pi/myproject
  6. Check if you have a C/C++ compiler by default: $ gcc
  7. Write your first program using nano program: $ nano hello.c

          #include <stdio.h>

          int main(int argc, char *argv[]){

                 printf(“Hello, Pi3!\n”);

                 return 0;


     8. Save that program and exit: ctrl+x then y

9. Compile the source code: $ gcc hello.c -o hello

10. Run the program: $ ./hello

Hello, Pi3!

Have fun, go mad!

(Visited 345 times, 1 visits today)