Subscribe Us

banner image

Breaking News

How to create and run C program using CodeBlocks

Introduction

CodeBlocks is a cross-platform (Linux, Mac, Windows (uses wxWidgets)), open-source, free IDE that supports GCC, Visual C++, and Clang compilers.

CodeBlocks is a powerful IDE for creating, compiling, executing and debugging C/C++ programs.

Please read previous post : How To Install CodeBlocks IDE on Windows

Create C Program In CodeBlocks IDE

  1. Open CodeBlocks, go to Start Menu > All Apps > CodeBlocks > CodeBlocks
  2. Click on the File menu, select New > File…
    run C program using CodeBlocks

      
  3. From the New form template window select “C/C++ source” and click the “Go” button. 
    run C program using CodeBlocks

  4. If you see a welcome message, click the “Next >” button to skip the welcome message. 
    run C program using CodeBlocks

  5. On the next window, select your language from C/C++ source window and click the “Next >” button. 
    run C program using CodeBlocks

  6. On the next window, 
    • Click the ellipsis button present under “Filename with full path :” Browse your C workspace (folder), navigate to save workspace (folder) (ex: D:\CodeBlocks\).
    • Click the “Finish” button. 
      run C program using CodeBlocks

  7. Write and save your first C program. Press "Ctrl+S" to save. Ex : 
    Source Code :
    run C program using CodeBlocks

Compile and run C program in CodeBlocks

 Once you created your first C program it's time to compile and run your program.

  1. Go to menu Build > "Build and Run" or just press F9 and then OK, when you are asked if you want to build the project. 
    run C program using CodeBlocks

  2. A console will open and you will see the greeting on the screen.  
    run C program using CodeBlocks

Thanks for reading!

No comments

Pembaca yang baik selalu meninggalkan komentar sesudah membaca ^_^
Terimakasih sudah mengisi komentar