Home > Development Tools > notepad > How to run C program in notepad++

How to run C program in notepad++

下次还敢
Release: 2024-04-08 03:33:20
Original
812 people have browsed it

How to run C programs in Notepad

Step 1: Install MinGW (Minimalist GNU for Windows)

To compile and run C program, you need to install MinGW, which is a GNU compiler toolchain for Windows. Download and install MinGW from the [MinGW website](https://sourceforge.net/projects/mingw/).

Step 2: Set environment variables

  • OpenControl Panel > System and Security > System
  • Click Advanced System Settings
  • In the Advanced tab, click Environment Variables
  • In the System Variables section, find the Path variable and select it
  • Click Edit , add the following path at the end of the Variable Value box:

    • C:\MinGW\bin (replace with the MinGW installation directory)
  • Click OK to save changes.

Step 3: Create a C Program

  • In Notepad, create a new file.
  • Enter the following code:
<code class="c">#include <stdio.h>

int main() {
    printf("Hello, world!\n");
    return 0;
}</code>
Copy after login
  • Save the file as hello.c.

Step 4: Compile the program

  • Press the F5 key or click the Run menu The in compiles the current file .
  • Notepad will open a console window and start compiling the program.

Step 5: Run the program

  • After successful compilation, the program will automatically run in the console window.
  • You will see the following output:
<code>Hello, world!</code>
Copy after login

The above is the detailed content of How to run C program in notepad++. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template