Programming Articles

Page 1012 of 2547

How to pass a 2D array as a parameter in C?

George John
George John
Updated on 15-Mar-2026 1K+ Views

In C programming, a 2D array can be passed as a parameter to a function in several ways. The method depends on whether the array dimensions are known at compile time or need to be determined at runtime. Syntax // Method 1: Fixed dimensions (known at compile time) void function_name(int arr[ROWS][COLS]); // Method 2: Variable dimensions (C99 and later) void function_name(int rows, int cols, int arr[rows][cols]); // Method 3: Using pointer to array void function_name(int (*arr)[COLS]); Method 1: Using Fixed Dimensions When array dimensions are known at compile time, you can specify ...

Read More

PHP – grapheme_strlen() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 383 Views

A grapheme is the smallest functional unit of a writing system. Graphemes can be interpreted as the smallest units of writing that correspond with sounds. The grapheme_strlen() function in PHP is used to get the string length in grapheme units. This function does not get the byte or character's length but counts the actual displayed characters, making it useful for Unicode text with combining characters. The grapheme_strlen function is supported in PHP 5.3.0 and higher versions. Note: The Intl extension must be installed and enabled to use this function. Syntax int grapheme_strlen(string $input) ...

Read More

PHP – idn_to_ascii() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 648 Views

The idn_to_ascii() function in PHP is used to convert a Unicode domain name into IDNA ASCII form. IDNA stands for Internationalizing Domain Names in Applications. It is a mechanism for handling internationalized domain names containing non-ASCII characters. Syntax string idn_to_ascii( string $domain, int $flags = IDNA_DEFAULT, int $variant = INTL_IDNA_VARIANT_UTS46, array &$idna_info = null ) Parameters idn_to_ascii() accepts the following four parameters − $domain − This is the domain to be converted; it must be UTF-8 encoded. $flags − This ...

Read More

PHP – exif_imagetype() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 1K+ Views

The EXIF (Exchangeable image file format) PHP extension enables you to work with metadata from images taken by digital devices like digital cameras and cell phones. The exif_imagetype() function determines the type of an image by reading its first bytes and checking its signature. This is useful for validating file types before processing or checking browser compatibility. Syntax int exif_imagetype(string $filename) Parameters The function accepts a single parameter: $filename − Path to the image file to check Return Value Returns an integer constant representing the image type when a ...

Read More

Declare variable as constant in C

Ankith Reddy
Ankith Reddy
Updated on 15-Mar-2026 21K+ Views

In C programming, variables can be declared as constants using the const keyword or the #define preprocessor directive. Constants ensure that variable values cannot be modified after initialization, providing data integrity and preventing accidental changes. Syntax const datatype variable_name = value; #define CONSTANT_NAME value Method 1: Using const Keyword Variables can be declared as constants by using the const keyword before the datatype of the variable. The constant variables can be initialized once only. The default value of uninitialized constant variables is zero. #include int main() { ...

Read More

PHP – exif_read_data() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 1K+ Views

The exif_read_data() function in PHP reads the EXIF (Exchangeable image file format) headers from an image file. This function extracts metadata information such as camera settings, GPS coordinates, timestamps, and technical details from JPEG and TIFF images. Note: This function requires the EXIF extension to be enabled in PHP. On most systems, it's enabled by default, but you can check with extension_loaded('exif'). Syntax array|false exif_read_data( string $file, string $sections = null, bool $arrays = false, bool $thumbnail = false ) ...

Read More

Initialization of global and static variables in C

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

In C language both the global and static variables must be initialized with constant values. This is because the values of these variables must be known at compile time before the program execution starts. An error will be generated if the constant values are not provided for global and static variables. Syntax // Global variable initialization data_type variable_name = constant_value; // Static variable initialization static data_type variable_name = constant_value; Example 1: Valid Initialization with Constants This example demonstrates the correct way to initialize global and static variables using constant values − ...

Read More

PHP – How to get or set the path of a domain?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 697 Views

The bindtextdomain() function in PHP is used to set or get the path of a domain for internationalization (i18n) purposes. It binds a message domain to a specific directory containing translation files. Syntax string bindtextdomain(string $domain, string $directory) Parameters bindtextdomain() accepts two parameters − $domain − The message domain name (typically your application name). $directory − The directory path where translation files are stored. If NULL, it returns the currently set directory for the domain. Return Value bindtextdomain() returns the full pathname for the domain directory currently set, or ...

Read More

PHP – mb_ereg_search_init() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 183 Views

The mb_ereg_search_init() function in PHP initializes the string and regular expression pattern for multibyte regular expression searches. It prepares the search parameters that will be used by subsequent functions like mb_ereg_search(), mb_ereg_search_pos(), and mb_ereg_search_regs(). Syntax bool mb_ereg_search_init( string $string, string $pattern = null, string $options = null ) Parameters mb_ereg_search_init() accepts three parameters − string − The target string to search in. pattern − The regular expression pattern (optional). options − Search options like "i" for case-insensitive matching (optional). Return Value ...

Read More

PHP – mb_strcut() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 538 Views

The mb_strcut() function in PHP is used to extract a substring from a string based on byte positions rather than character positions. This is particularly useful when working with multi-byte character encodings like UTF-8, where a single character might use multiple bytes. Syntax string mb_strcut( string $str, int $start, int $length = null, string $encoding = null ); Parameters The mb_strcut() function accepts the following parameters − str − The input string to be cut. start − The starting byte ...

Read More
Showing 10111–10120 of 25,466 articles
Advertisements