Articles on Trending Technologies

Technical articles with clear explanations and examples

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

When do function-level static variables get initialized in C/C++?

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

Static variables can be defined using the static keyword. They are variables that remain in memory while the program is running, meaning their lifetime is the entire program execution. This is different from automatic variables, which remain in memory only when their function is running and are destroyed when the function exits. Function-level static variables are initialized only once − the first time the function is called. The memory for them is allocated at program load time, but the initialization occurs during the first function execution. Syntax static data_type variable_name = initial_value; Example: Static ...

Read More

Why C/C++ variables doesn’t start with numbers

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 2K+ Views

In C/C++, a variable name can have alphabets, numbers, and the underscore( _ ) character. There are some keywords in the C/C++ language. Apart from them, everything is treated as an identifier. Identifiers are the names of variables, constants, functions, etc. Syntax Valid identifier naming rules in C − // Valid identifier patterns: [a-zA-Z_][a-zA-Z0-9_]* // Valid examples: variable_name, _count, num1, my_var // Invalid examples: 1variable, 2name, 3_count Why Variables in C/C++ Can't Start with Numbers? In C and C++, variable names (also known as identifiers) cannot start with a digit due to ...

Read More

PHP – idn_to_ascii() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 725 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

How do I find the length of an array in C/C++?

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

To find the length of an array in C, we can use various approaches that are essential for array manipulation. Finding the length of an array is a fundamental task used in looping through arrays, sorting, searching, and memory management operations. In this article, we will explore different methods to determine the size of an array in C programming. Syntax // Method 1: Using sizeof operator int length = sizeof(array) / sizeof(array[0]); // Method 2: Using pointer arithmetic int length = *(&array + 1) - array; Method 1: Using sizeof() Operator The ...

Read More
Showing 22051–22060 of 61,299 articles
Advertisements