C++ Articles

Page 16 of 597

How does the compilation/linking process work in C/C++?

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 5K+ Views

The compilation of a C program involves several distinct phases that transform source code into an executable program. Understanding this process helps debug compilation errors and optimize build workflows. Compilation Process Overview Source Code (main.c) Preprocessor (main.i) Compiler (main.s) Assembler (main.o) Linker (executable) ...

Read More

What is a segmentation fault in C/C++?

Priya Pallavi
Priya Pallavi
Updated on 15-Mar-2026 9K+ Views

A segmentation fault (commonly called "segfault") occurs when your program attempts to access an area of memory that it is not allowed to access. In other words, when your program tries to access memory that is beyond the limits that the operating system allocated for your program. Segmentation faults are one of the most common runtime errors in C programming and cause the program to terminate immediately with an error message. Common Causes Seg faults are mostly caused by pointers that are − Used without being properly initialized. Used after the memory they point to ...

Read More

How to debug a core in C/C++?

Ankith Reddy
Ankith Reddy
Updated on 15-Mar-2026 576 Views

A process dumps core when it is terminated by the operating system due to a fault in the program. The most typical reason this occurs is that the program accessed an invalid pointer value like NULL or some value out of its memory area. As part of that process, the operating system tries to write debugging information to a file to allow us to analyze what happened. Prerequisites Installation Requirements: Install GDB debugger: sudo apt-get install gdb (Ubuntu/Debian) or yum install gdb (CentOS/RHEL) Enable core dumps: ulimit -c unlimited Compile programs with debug symbols: gcc -g ...

Read More

What does int argc, char *argv[] mean in C/C++?

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 8K+ Views

In C programming, int argc and char *argv[] are parameters of the main function that allow your program to receive command-line arguments when executed. argc stands for argument count and argv stands for argument vector (or argument values). Syntax int main(int argc, char *argv[]) { // Program code return 0; } Parameters argc − An integer representing the number of command-line arguments passed to the program (including the program name itself) argv[] − An array of character pointers (strings) containing the actual command-line arguments ...

Read More

Is C++0x Compatible with C?

Srinivas Gorla
Srinivas Gorla
Updated on 15-Mar-2026 179 Views

C++0x (later standardized as C++11) is not fully compatible with C, just as previous C++ standards were not. While C++ was designed to be largely compatible with C, there are several key differences that prevent full compatibility. Syntax // C code that may not compile in C++ // or behaves differently Key Compatibility Issues Example 1: Implicit void* Conversion In C, you can implicitly convert from void* to other pointer types. C++ requires explicit casting − #include #include int main() { /* This works in C but not in C++ */ ...

Read More

How do I set up C/C++ on Eclipse in Windows?

Arushi
Arushi
Updated on 15-Mar-2026 11K+ Views

Setting up C/C++ development environment on Eclipse in Windows requires installing a compiler and the Eclipse CDT plugin. This guide walks you through the complete setup process using MinGW GCC compiler. Prerequisites System Requirements: Windows 7 or later, Java 8 or higher installed on your system. Step 1: Install MinGW GCC Compiler Eclipse requires a C/C++ compiler to build and run programs. MinGW (Minimalist GNU for Windows) is recommended for its simplicity − Visit the MinGW official website at www.mingw.org Download the latest MinGW installation program (MinGW-.exe) Run the installer and select ...

Read More

When to use C over C++, and C++ over C?

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

Both C and C++ are powerful programming languages used by developers to write system-level and application programs. C follows a procedural programming paradigm with a simple and structured approach, while C++ supports both procedural and object-oriented programming. Although both languages are widely used across various fields, they have different strengths and use cases. This article explores when to choose C over C++ and vice versa. When to Use C Language? C is preferred in the following scenarios − System Programming: When writing low-level system software like operating systems, embedded systems, or ...

Read More

What is the difference Between C and C++?

Alankritha Ammu
Alankritha Ammu
Updated on 15-Mar-2026 1K+ Views

C and C++ are closely related programming languages, with C++ being developed as an extension of C. While they share many similarities, there are fundamental differences in their design philosophy and features. Key Differences Between C and C++ Aspect C C++ Programming Paradigm Procedural Programming Object-Oriented Programming Building Blocks Functions Objects and Classes Memory Management malloc() and free() new and delete operators Variable References Not supported Supported Function Overloading Not supported Supported Operator Overloading Not supported Supported Exception Handling Not supported try-catch ...

Read More

Swap two variables in one line in C/C++, Python, PHP and Java

Hafeezul Kareem
Hafeezul Kareem
Updated on 15-Mar-2026 675 Views

In this tutorial, we are going to learn how to swap two variables in different languages. Swapping means interchanging the values of two variables. Let's see an example. Input a = 3 b = 5 Output a = 5 b = 3 Let's see how to achieve this in different programming languages. Python We can swap variables with one line of code in Python using tuple unpacking − Example # initializing the variables a, b = 3, 5 # printing before swapping print("Before swapping:-", a, b) ...

Read More

Difference between strncmp() and strcmp() in C/C++

George John
George John
Updated on 14-Mar-2026 2K+ Views

Both strncmp() and strcmp() are used in C/C++ programs for lexicographical string comparison. The strcmp() compares two strings till the null character is found, whereas strncmp() only compares a specified number of characters. What is strncmp() ? The function strncmp() is used to compare left string to right string up to a number. It works same as strcmp(). It returns a value greater than zero when the matching character of left string has greater ASCII value than the character of the right string. Returns a value less than zero when the matching character of left string has lesser ASCII value ...

Read More
Showing 151–160 of 5,962 articles
« Prev 1 14 15 16 17 18 597 Next »
Advertisements