Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
C Articles
Page 95 of 96
How to debug a core in C/C++?
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 MoreWhat does int argc, char *argv[] mean in C/C++?
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 MoreIs C++0x Compatible with C?
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 MoreHow can I write in order with for loop or while loop?
In C programming, we can create ordered patterns using for loops or while loops. This example demonstrates how to generate a specific numerical pattern where each line contains repeating digits based on the line number. Syntax for(initialization; condition; increment) { // loop body } while(condition) { // loop body increment; } Method 1: Using For Loop This approach uses nested for loops to create a pattern where each line displays the line number followed by repeating 0s and 1s − ...
Read MoreHow do I set up C/C++ on Eclipse in Windows?
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 MoreWhen to use C over C++, and C++ over C?
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 MoreWhat is the difference Between C and C++?
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 MoreDifference between Java and C language
Both Java and C are among the most popular programming languages in the world. Java is an object-oriented, platform-independent language, while C is a procedural, platform-dependent language. Despite their differences, both have been widely influential in shaping modern software development. Key Differences Feature Java C Developed By James Gosling (1995) Dennis M. Ritchie (1969–1973) Paradigm Object-Oriented (high-level) Procedural (middle-level) Compilation Source → bytecode → JVM interprets/JIT compiles Source → machine code (compiled directly) Functional Unit Objects and classes Functions Inheritance Supported Not supported Threading ...
Read MoreDifference between float and double in C/C++
In C/C++, float and double are data types used to represent floating-point numbers (numbers with a decimal part). The key difference is precision − double has twice the precision of float, which means it can represent numbers with more decimal digits of accuracy. Precision and Storage float uses 32 bits (1 sign bit, 8 exponent bits, 23 mantissa bits) and provides about 6–7 significant decimal digits of precision. double uses 64 bits (1 sign bit, 11 exponent bits, 52 mantissa bits) and provides about 15–16 significant decimal digits of precision. Key Differences Feature float ...
Read MoreDifference between Structure and Array in C
In C, both structures and arrays are used as containers to store data. The key difference is that a structure can hold variables of different data types, while an array can only hold variables of the same data type. Example The following example demonstrates the difference between a structure and an array in C ? #include // Structure: holds different data types struct Student { char name[20]; int age; float gpa; }; int main() { // Structure ...
Read More