C++ Articles

Page 2 of 597

How do I link a C++ program with an HTML page?

Ayush Singh
Ayush Singh
Updated on 16-Mar-2026 10K+ Views

WebAssembly (WASM) is a binary instruction format that enables high-performance languages like C++ to run in web browsers. It allows developers to integrate C++ functionality directly into web applications by compiling C++ code to WebAssembly and calling it from JavaScript within HTML pages. Prerequisites Before starting, ensure you have the following tools installed − C++ Compiler − GCC (GNU Compiler Collection) or Visual Studio with C++ support. Emscripten SDK − A toolchain that compiles C++ to WebAssembly. Download from the official website at https://emscripten.org. Step 1: Install Emscripten SDK Download and install the ...

Read More

How to call a JavaScript function from C++?

Akansha Kumari
Akansha Kumari
Updated on 15-Mar-2026 1K+ Views

Calling a JavaScript function directly from C++ depends on the environment and the system; for this, make sure you have embedded a JavaScript engine or integrated C++ with JavaScript. In this article, we will be using Emscripten (C++ to JavaScript in WebAssembly) to call a JavaScript function from C++. For this, you have to compile the C++ program to WebAssembly using Emscripten and then call JavaScript functions from C++. So, first, create the C++ file with the header . How Emscripten Works Emscripten compiles C++ code to WebAssembly, which runs in browsers. The compiled WebAssembly module can ...

Read More

What is the difference between JavaScript and C++?

Alshifa Hasnain
Alshifa Hasnain
Updated on 15-Mar-2026 3K+ Views

In this article, we will learn the difference between JavaScript and C++. JavaScript and C++ are two widely used programming languages, each designed for different purposes and environments. While JavaScript is primarily used for web development, C++ is known for its high-performance applications, including game development and system programming. What is JavaScript? JavaScript is a lightweight, interpreted programming language designed for creating network-centric applications. It is complementary to and integrated with Java. JavaScript is very easy to implement because it is integrated with HTML. It is open and cross-platform, running in web browsers and server environments like Node.js. ...

Read More

destroy() method in Tkinter - Python

Pradeep Elance
Pradeep Elance
Updated on 15-Mar-2026 6K+ Views

The destroy() method in Tkinter removes a widget from the screen and frees up memory. It's essential for controlling widget behavior and cleaning up GUI components when they're no longer needed. Syntax widget.destroy() Where widget can be any Tkinter widget including windows, buttons, labels, frames, etc. Example - Button Destruction Chain This example demonstrates how buttons can destroy each other and the main window ? from tkinter import * from tkinter.ttk import * # Create main window base = Tk() base.title("Destroy Method Demo") base.geometry("300x250") # Button that closes the ...

Read More

Locate unused structures and structure-members

Satish Kumar
Satish Kumar
Updated on 15-Mar-2026 1K+ Views

Structures in C are user-defined data types that group related variables together. As codebases grow, some structures and their members may become unused, leading to cluttered code and wasted memory. This article explores methods to identify and remove unused structures and structure members in C programs. Syntax struct structure_name { data_type member1; data_type member2; // ... more members }; Why Remove Unused Structures and Members? Unused structures and members can impact performance and readability of your code. Here are some reasons why ...

Read More

Corrupt stack problem in C, C++ program

Satish Kumar
Satish Kumar
Updated on 15-Mar-2026 3K+ Views

The corrupt stack problem is a critical runtime issue in C programming that occurs when the program's stack memory becomes compromised. This can lead to unpredictable program behavior, crashes, and security vulnerabilities. Understanding stack corruption is essential for writing robust C programs. What is a Stack in C? In C, the stack is a region of memory used for automatic storage of local variables, function parameters, and return addresses. It operates on a Last-In-First-Out (LIFO) principle, where the most recently allocated memory is freed first when functions return. What is Corrupt Stack Problem? Stack corruption occurs ...

Read More

Significance of Lambda Function in C/C++

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 15-Mar-2026 4K+ Views

Lambda Function − Lambda functions are anonymous inline functions that don't require any implementation outside the scope where they are defined. They provide a concise way to write small functions directly at the point of use. Lambda functions can also be stored in variables and treated as objects that can be called (called functors). When the compiler encounters a lambda function definition, it creates a custom object for that lambda. Note: Lambda functions are a C++11 feature and are NOT available in C. They are part of the C++ standard, not C. In C programming, you would use ...

Read More

Different ways to declare variable as constant in C and C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 1K+ Views

In C programming, constants are fixed values that cannot be changed during program execution. There are multiple ways to declare variables as constants, each with its own characteristics and use cases. Syntax const data_type variable_name = value; #define MACRO_NAME value enum { constant1, constant2, ... }; Method 1: Using const Keyword The const keyword is the most common way to create read-only variables. Once declared, attempting to modify the value results in a compilation error − #include int main() { const int value = 5; ...

Read More

Count minimum bits to flip such that XOR of A and B equal to C in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 451 Views

We are given three binary sequences A, B and C of length N. Each sequence represents a binary number. We have to find the number of bit flips required in A and B such that XOR of A and B results in C. Syntax int flipCount(int A[], int B[], int C[], int n); First, let us understand the XOR operation truth table − X ...

Read More

Writing C/C++ code efficiently in Competitive programming

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 512 Views

In competitive programming, writing efficient C code is crucial for achieving better performance and rankings. Fast execution and optimal memory usage can make the difference between acceptance and time limit exceeded. Key Concepts Template − Code that works with different data types without rewriting Macro − Named code fragment that gets replaced during preprocessing Dynamic Arrays − Arrays that can resize during runtime Essential Optimization Techniques Fast Input/Output Methods Using scanf() and printf() instead of slower alternatives provides significant performance improvements ? #include int main() { ...

Read More
Showing 11–20 of 5,962 articles
« Prev 1 2 3 4 5 597 Next »
Advertisements