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
Server Side Programming Articles
Page 1006 of 2109
PHP – How to get the modulus of an arbitrary precision number using bcmod() function?
In PHP, bcmod() math function is used to calculate the modulus of an arbitrary precision number. The bcmod() function takes arbitrary precision numbers as strings and returns the remainder after dividing the dividend by the divisor. Unless the divisor is 0, the result has the same sign as the dividend. Syntax bcmod(string $dividend, string $divisor[, int $scale = 0]) Note − The scale parameter was added from PHP 7.2.0 version. Parameters The bcmod() function accepts the following parameters ? $dividend − The dividend that is divided by ...
Read MoreHow to print % using printf()?
In C, the printf() function uses the percent symbol (%) as a format specifier. To print the actual % character as text, you need to use a double percent (%%) because a single % has special meaning in printf() and will not display anything. Syntax printf("%%"); // Prints a single % character Example 1: Basic % Printing Here's how to print the % symbol using printf() − #include int main() { printf("Single percent: %%"); printf("Percentage: 85%%"); printf("Multiple: ...
Read MorePHP – How to multiply two arbitrary precision numbers using bcmul() function?
In PHP, bcmul() function is used to multiply two arbitrary precision numbers. This function is particularly useful when dealing with very large numbers or when you need precise decimal calculations that exceed PHP's floating-point precision limits. Syntax string bcmul(string $num1, string $num2, ?int $scale = null) Parameters The bcmul() 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 − Optional integer parameter that sets the number of decimal places ...
Read More"register" keyword in C
In C programming, the register keyword is a storage class specifier that suggests to the compiler to store a variable in CPU registers instead of main memory. Register variables provide faster access since CPU registers are much faster than memory. However, taking the address of a register variable is not allowed. Syntax register data_type variable_name; Properties of Register Variables Scope: Local to the function in which they are declared Default value: Garbage value (uninitialized) Lifetime: Until the end of the block execution Storage: CPU registers (compiler's choice) Address: Cannot use address-of operator (&) ...
Read MorePHP – 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 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 More