Articles on Trending Technologies

Technical articles with clear explanations and examples

C program that won't compile in C++

Nishtha Thakur
Nishtha Thakur
Updated on 15-Mar-2026 607 Views

C++ is largely based on C, but it enforces stricter type checking and syntax rules. While most C programs compile in C++, some valid C code will not compile in C++ due to these stricter rules. Understanding these differences helps in writing portable code. Syntax There is no specific syntax for this concept, but rather a collection of C language features that C++ treats differently or rejects entirely. Example 1: Function Declaration Requirements In C, functions can be called before declaration (with implicit declaration), but C++ requires explicit declaration − #include int ...

Read More

How to Check If Two Arrays are Equal in PHP?

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 6K+ Views

When working with arrays in PHP, you often need to compare them to check if they contain the same elements. Array equality can mean different things − same elements in same order, same elements regardless of order, or strict type matching. This article explores different approaches to check if two arrays are equal in PHP. Using the == Operator The == operator provides a loose comparison, checking if arrays have the same elements in the same order without strict type checking ? The arrays are equal Using the === Operator ...

Read More

Floating Point Operations and Associativity in C, C++ and Java

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 374 Views

In C, mathematical operations with floating point numbers do not always follow the associativity rule. This means that (a + b) + c may not equal a + (b + c) due to precision limitations and rounding errors in floating-point arithmetic. Syntax float result1 = a + (b + c); /* Right associativity */ float result2 = (a + b) + c; /* Left associativity */ Example: Floating Point Associativity Issue Here's an example demonstrating how floating point operations violate associativity − #include int ...

Read More

PHP program to find the perimeter of rectangle

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 7K+ Views

A rectangle is a closed two-dimensional figure with 4 sides where opposite sides are equal and parallel. The perimeter is the total distance around the rectangle, calculated by adding all four sides. In this tutorial, we'll learn different PHP approaches to calculate rectangle perimeter. Length Breadth Length Breadth Formula The formula for calculating rectangle perimeter is − Perimeter = 2 × (Length + Breadth) Where length is the horizontal distance and breadth is the vertical distance. Direct Formula Approach The ...

Read More

Undefined Behaviour in C and C++

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 15-Mar-2026 535 Views

In C programming, undefined behavior refers to situations where the language standard does not specify what should happen. When undefined behavior occurs, the program may produce unpredictable results, crash, or appear to work correctly but fail later under different conditions. Syntax /* Undefined behavior occurs when code violates C language rules */ /* Examples: dereferencing NULL pointers, buffer overflows, etc. */ Common Examples of Undefined Behavior in C Division by Zero Using Uninitialized Variables Dereferencing NULL Pointers Signed Integer Overflow Modifying String Literals 1. Division by Zero Division by zero ...

Read More

PHP Program to Check if a Number is an Armstrong Number

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 5K+ Views

An Armstrong number is a number in which the sum of its digits raised to the power of the number of digits is equal to the number itself. In this article, we will discuss how to check if a given number is an Armstrong number using PHP. Examples Let's understand Armstrong numbers with some examples ? Example 1: 9474 This is a four-digit number with digits 9, 4, 7, and 4. 9474 = 9⁴ + 4⁴ + 7⁴ + 4⁴ = 6561 + 256 + 2401 + 256 ...

Read More

How to check if a variable is NULL in C/C++?

Tapas Kumar Ghosh
Tapas Kumar Ghosh
Updated on 15-Mar-2026 27K+ Views

In C, there is no special method for comparing NULL values. We can use if statements to check whether a variable is null or not. NULL is a macro that represents a null pointer constant, typically defined as (void*)0. Syntax if (pointer == NULL) { /* pointer is null */ } if (pointer != NULL) { /* pointer is not null */ } Example 1: Checking File Pointer for NULL Here, we attempt to open a file in read mode that does not exist on ...

Read More

How to get selected option value in PHP

PHP
NIKI
NIKI
Updated on 15-Mar-2026 1K+ Views

In this article, we will see how to get selected option values in PHP from HTML forms, with necessary examples. What is "option value" in PHP? Drop-down menus are created using the and tags. PHP allows users to select one or more options from a list through form submissions. Syntax Below is the syntax of the Option Value in PHP − Text Label-1 Text Label-2 The attributes related to the tag are − ...

Read More

Designated Initializers in C

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 1K+ Views

In C90 standard we have to initialize the arrays in the fixed order, like initialize index at position 0, 1, 2 and so on. From C99 standard, they have introduced designated initializing feature in C. Here we can initialize elements in random order. Initialization can be done using the array index or structure members. This extension is not implemented in GNU C++. Syntax // Array designated initialization type array[size] = {[index] = value, [index] = value, ...}; // Range designated initialization type array[size] = {[first ... last] = value}; // Structure designated initialization struct name ...

Read More

Name Mangling and extern "C" in C++

Nishtha Thakur
Nishtha Thakur
Updated on 15-Mar-2026 1K+ Views

In C++, function overloading allows multiple functions with the same name but different parameter types or numbers. However, this creates a problem: how does the compiler distinguish between these functions in the object code? The solution is a technique called name mangling. Syntax extern "C" { // C function declarations } What is Name Mangling? Name mangling is a technique where the compiler modifies function names by adding information about parameters to create unique identifiers. C++ has no standardized name mangling scheme, so different compilers use different approaches. Example: ...

Read More
Showing 21811–21820 of 61,297 articles
Advertisements