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
Programming Articles
Page 1019 of 2547
PHP – How to add two arbitrary precision numbers using bcadd() function?
In PHP, bcadd() math function is used to add two arbitrary precision numbers. The bcadd() function takes two arbitrary precision numbers as strings and returns their sum, scaling the result to a specified precision. Syntax string bcadd(string $num1, string $num2, int $scale = 0) Parameters The bcadd() function accepts three parameters − $num1 − The left operand as a string representing an arbitrary precision number. $num2 − The right operand as a string representing an arbitrary precision number. $scale − ...
Read More"extern" keyword in C
The extern keyword in C is used to declare variables and functions that are defined elsewhere, either in the same file or in other source files. It extends the visibility of variables and functions across multiple files, making them globally accessible. Syntax extern data_type variable_name; extern data_type function_name(parameters); Key Properties Scope − Global throughout the program, not bound by any function. Default value − Global variables are initialized to zero by default. Lifetime − Exists until the end of program execution. Important Points External variables can be declared multiple times but ...
Read MoreHow to get an affine transformation matrix in PHP using imageaffinematrixget()?
The imageaffinematrixget() function is an inbuilt PHP function that generates an affine transformation matrix. This function is commonly used in computer graphics and image processing to define transformations like scaling, rotation, translation, and shearing ? Note: This function requires the GD extension to be installed in PHP. Syntax array imageaffinematrixget(int $type, mixed $options) Parameters The function accepts two parameters ? $type − An integer constant that specifies the transformation type: IMG_AFFINE_TRANSLATE − Translation (movement) IMG_AFFINE_SCALE − Scaling (resize) IMG_AFFINE_ROTATE − Rotation IMG_AFFINE_SHEAR_HORIZONTAL − Horizontal shearing IMG_AFFINE_SHEAR_VERTICAL − Vertical ...
Read MoreCount spaces, uppercase and lowercase in a sentence using C
In C programming, counting different types of characters in a string is a common task. This involves analyzing each character to determine if it's uppercase, lowercase, a digit, whitespace, or a special character. Syntax for (int i = 0; str[i] != '\0'; i++) { // Check character type using ASCII values if (str[i] >= 'A' && str[i] = 'a' && str[i] = '0' && str[i] = 'A' && str[i] = 'a' && str[i] = '0' && str[i]
Read MoreHow to convert a string to a integer in C
In C programming, converting a string to an integer is a common task that can be accomplished using several built-in functions. The most commonly used functions are atoi(), strtol(), and sscanf(). Syntax int atoi(const char *str); long strtol(const char *str, char **endptr, int base); int sscanf(const char *str, const char *format, ...); Method 1: Using atoi() Function The atoi() function converts a string to an integer. It stops reading when it encounters a non-digit character − #include #include int main() { char str[] = "12345"; ...
Read MoreHow to check antialias functions be used or not by using imageantialias() function in PHP?
The imageantialias() function is an inbuilt PHP function that enables or disables antialiasing for drawing operations. It activates fast drawing anti-aliased methods for lines and wired polygons, working only with true-color images without alpha component support. Syntax bool imageantialias($image, $enabled) Parameters The imageantialias() function takes two parameters: $image − A GdImage object or image resource created by image creation functions like imagecreatetruecolor(). $enabled − A boolean value that enables (true) or disables (false) antialiasing. Return Value Returns true on success or false on failure. Example Here's how ...
Read MoreList of Common Reasons for Segmentation Faults in C/C++
The main reason for segmentation fault is accessing memory that is either not initialized, out of bounds for your program or trying to modify string literals. These may cause a segmentation fault though it is not guaranteed that they will cause a segmentation fault. Here are some of the common reasons for segmentation faults − Accessing an array out of bounds Dereferencing NULL pointers Dereferencing freed memory Dereferencing uninitialized pointers Incorrect use of the "&" (address of) and "*" (dereferencing) operators Improper formatting specifiers in printf and scanf statements Stack overflow Writing to read-only memory Common ...
Read MoreHow to apply a 3×3 convolution matrix using imageconvolution() in PHP?
The imageconvolution() function is an inbuilt function in PHP that applies a 3×3 convolution matrix to an image using coefficients and offset values. This function is commonly used for image filtering effects like blur, sharpening, and edge detection. Syntax bool imageconvolution($image, $matrix, $div, $offset) Parameters The imageconvolution() function accepts four parameters: $image − A GD image resource created using image creation functions like imagecreatetruecolor() $matrix − A 3×3 array containing float values representing the convolution kernel $div − The divisor used for normalization ...
Read MoreHow does the compilation/linking process work in C/C++?
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 MoreHow to apply a gamma correction to a Graphics Draw (GD) image in PHP?
The imagegammacorrect() function is an inbuilt PHP function that applies gamma correction to a Graphics Draw (GD) image. Gamma correction adjusts the brightness and contrast of an image by modifying the relationship between input and output pixel values. Syntax bool imagegammacorrect(resource $image, float $inputgamma, float $outputgamma) Parameters The imagegammacorrect() function takes three parameters ? $image − The image resource to apply gamma correction to $inputgamma − The input gamma value (typically between 0.1 and 10.0) $outputgamma − The output gamma value (typically between 0.1 and 10.0) Return Values Returns ...
Read More