Chandu yadav

Chandu yadav

810 Articles Published

Articles by Chandu yadav

Page 24 of 81

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

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 355 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

C program to write an image in PGM format

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

The PGM (Portable Gray Map) format is part of the Netpbm package that provides an easy way to store 2D arrays as grayscale images. Unlike complex formats like PNG or JPEG, PGM files use a simple ASCII format that makes them easy to create and read programmatically. Each PGM file starts with a magic number P2 (for ASCII encoding) followed by dimensions, maximum gray value, and pixel data. The format is human-readable and portable across different platforms. Syntax P2 width height max_gray_value pixel_values... PGM File Structure To write a PGM file, follow these ...

Read More

Data Types we cannot use to create array in C

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

In C programming, arrays can be created using most data types like int, char, float, double, etc. However, there are certain data types that cannot be used to create arrays. The most notable restriction is with the void data type. Syntax datatype array_name[size]; // Valid for most data types void array_name[size]; // Invalid - compilation error Data Types That Cannot Be Used for Arrays 1. Void Data Type The void data type represents "no type" and has no size. Since arrays need to know the size of ...

Read More

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 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

imagecolorstotal() function in PHP

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

The imagecolorstotal() function returns the number of colors in an image's palette. This function only works with palette−based images (like GIF or PNG with limited colors), not true color images. Syntax imagecolorstotal($image) Parameters $image − An image resource created by one of the image creation functions like imagecreatefromgif() or imagecreatefrompng(). Return Value Returns the number of colors in the image's palette as an integer. For true color images, it returns 0. ...

Read More

How to specify Decimal Precision and scale number in MySQL database using PHPMyAdmin?

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

When working with DECIMAL data types in MySQL through PHPMyAdmin, you need to specify both precision and scale to properly store monetary values or other exact numeric data. This tutorial shows you how to configure decimal precision and scale using PHPMyAdmin interface. Understanding DECIMAL Precision and Scale The DECIMAL data type requires two parameters: DECIMAL(precision, scale) Where: Precision (X) − Total number of digits that can be stored Scale (Y) − Number of digits after the decimal point Example of DECIMAL Usage For DECIMAL(6, 4): Total digits: 6 Digits ...

Read More

imageconvolution() function in PHP

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

The imageconvolution() function in PHP applies a convolution matrix to an image resource. This function is used for image filtering effects like sharpening, blurring, edge detection, and embossing. Syntax bool imageconvolution(resource $image, array $matrix, float $div, float $offset) Parameters image − An image resource created by functions like imagecreatetruecolor() or imagecreatefromgif(). matrix − A 3x3 matrix represented as an array of three arrays, each containing three float values. div − The divisor used for normalization of the convolution result. Used to control the brightness of the output. offset − Color offset value added ...

Read More

imagecopymerge() function in PHP

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

The imagecopymerge() function copies and merges part of one image onto another with specified transparency. This function is useful for creating watermarks, overlays, or blending images together. Syntax imagecopymerge(dst_img, src_img, dst_x, dst_y, src_x, src_y, src_w, src_h, pct) Parameters dst_img − Destination image resource src_img − Source image resource dst_x − X-coordinate of destination point dst_y − Y-coordinate of destination point src_x − X-coordinate of source point src_y − Y-coordinate ...

Read More

imagechar() function in PHP

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

The imagechar() function in PHP draws a single character horizontally on an image. This function is useful for adding text elements to dynamically generated images. Syntax bool imagechar(resource $image, int $font, int $x, int $y, string $c, int $color) Parameters image − An image resource created by functions like imagecreate() or imagecreatetruecolor() font − Font size (1-5 for built-in fonts, or a loaded font identifier) x − x-coordinate for the character position y − y-coordinate for the character position c − The character to draw (only the first character of the string is ...

Read More
Showing 231–240 of 810 articles
« Prev 1 22 23 24 25 26 81 Next »
Advertisements