visual studio code c code example

Example 1: visual studio code

May the .code be with you...

Example 2: how to run c program from visual studio terminal

Fire up the terminal from VS code
Use the command "gcc filename.c" to compile the program
Use the command ".\a.exe" to run the program from the terminal

P.S. Remove "" before exceuting

Example 3: how to run cpp using gcc vscode

{
    "version": "0.1.0",
    "command": "make",
    "isShellCommand": true,
    "tasks": [
        {
            "taskName": "Makefile",

            // Make this the default build command.
            "isBuildCommand": true,

            // Show the output window only if unrecognized errors occur.
            "showOutput": "always",

            // Pass 'all' as the build target
            "args": ["all"],

            // Use the standard less compilation problem matcher.
            "problemMatcher": {
                "owner": "cpp",
                "fileLocation": ["relative", "${workspaceRoot}"],
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            }
        }
    ]
}

Example 4: visual studio code

I Have been using it for a long time so you have done a wise choice,
An IDE which is great for coding and debugging. If you want more development.

Example 5: Visual Studio Code: code not running for C++11

C_Cpp.default.includePath                          : string[]
C_Cpp.default.defines                              : string[]
C_Cpp.default.compileCommands                      : string
C_Cpp.default.macFrameworkPath                     : string[]
C_Cpp.default.forcedInclude                        : string[]
C_Cpp.default.intelliSenseMode                     : string
C_Cpp.default.compilerPath                         : string
C_Cpp.default.cStandard                            : c89 | c99 | c11
C_Cpp.default.cppStandard                          : c++98 | c++03 | c++11 | c++14 | c++17
C_Cpp.default.browse.path                          : string[]
C_Cpp.default.browse.databaseFilename              : string
C_Cpp.default.browse.limitSymbolsToIncludedHeaders : boolean