Programming Articles

Page 1014 of 2547

Return values of printf() and scanf() in C

Samual Sam
Samual Sam
Updated on 15-Mar-2026 13K+ Views

The printf() and scanf() functions are required for output and input respectively in C. Both of these functions are library functions and are defined in the stdio.h header file. Understanding their return values is crucial for error handling and program flow control. Syntax int printf(const char *format, ...); int scanf(const char *format, ...); The printf() Function Return Value The printf() function returns the number of characters that are printed successfully. If there is an error during output, it returns a negative value. Example #include int main() { ...

Read More

PHP – Get the internal settings of mbstring with mb_get_info()

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

The mb_get_info() function in PHP is used to get the internal settings of mbstring extension. This function is supported in PHP 5.4 or higher version and is essential for debugging and understanding current multibyte string configurations. Syntax array|string|int mb_get_info(string $type = "all") Parameters It accepts only a single parameter to get the multibyte information. $type − If the type parameter is not specified or it is specified as "all", then it will return all available mbstring settings. If a specific type is provided, it returns only that setting value. Available type values ...

Read More

Return type of getchar(), fgetc() and getc() in C

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 2K+ Views

In C programming, the character input functions getchar(), fgetc(), and getc() all return an int value, not a char. This is crucial because they need to return both valid character values (0-255) and the special value EOF (-1) to indicate end-of-file or error conditions. Syntax int getchar(void); int fgetc(FILE *stream); int getc(FILE *stream); Why int Return Type? All three functions return int instead of char because − EOF handling: EOF is typically -1, which cannot fit in an unsigned char range (0-255) Error detection: Distinguishes between actual character values and error conditions ...

Read More

PHP – mb_ereg_replace() function – Replace regular expression with multibyte support

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

In PHP, mb_ereg_replace() is used to replace a regular expression with multibyte support. It scans the string for matches to pattern, then replaces the matched text with the replacement, making it ideal for handling international characters and Unicode strings. Syntax string mb_ereg_replace(string $pattern, string $replacement, string $string, string $options = null) Parameters The function accepts the following four parameters − $pattern − The regular expression pattern. It may use multibyte characters in the pattern. $replacement − The replacement text used to replace the matched pattern. $string − The input string to be ...

Read More

pow() function in C

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 7K+ Views

The pow() function in C is used to calculate the power of a number. It computes base raised to the power of exponent and returns the result as a double. This function is declared in the math.h header file. Syntax double pow(double base, double exponent); Parameters base − The base value whose power is to be calculated exponent − The power value (exponent) Return Value Returns the value of base raised to the power of exponent as a double. Example 1: Basic Usage Here is a simple example ...

Read More

PHP – mb_ereg_replac_callback() function

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

In PHP, mb_ereg_replace_callback() function is used to perform a regular expression search and replace with multibyte support using a callback. It scans strings, matches them with a pattern, then replaces the matched text with the output of the callback function. This function is similar to mb_ereg_replace() but allows custom replacement logic through callbacks. It is supported in PHP 5.4 or higher versions. Syntax string mb_ereg_replace_callback(str $pattern, callback $callback, str $string, str $options) Parameters The function accepts the following four parameters − $pattern − The regular expression pattern. May use multibyte characters. $callback ...

Read More

Static functions in C

Samual Sam
Samual Sam
Updated on 15-Mar-2026 21K+ Views

A static function in C is a function that has a scope limited to its object file. This means the static function is only visible within the file where it is defined and cannot be accessed from other files. A function can be declared as static by placing the static keyword before the function name. Syntax static return_type function_name(parameters) { // function body } Example 1: Static Function in Same File Here's an example demonstrating a static function called within the same file − #include static ...

Read More

PHP – Match regular expression using mb_ereg_match()

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

In PHP, the mb_ereg_match() function is used for matching a given string with a regular expression pattern. This function only matches the string from the beginning and returns true if a match is found, else it returns false. It supports multibyte character sets, making it useful for international text processing. Syntax bool mb_ereg_match(string $pattern, string $string, string $options = null) Parameters It accepts the following three parameters − $pattern − The regular expression pattern to match against. $string − The input string being evaluated. ...

Read More

PHP – Get aliases of a known encoding type using mb_encoding_aliases()

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

In PHP, mb_encoding_aliases() is used to get the aliases of a known encoding type. This function returns all alternative names for a specified character encoding, which is useful when working with different systems that may use varying naming conventions for the same encoding. Syntax array mb_encoding_aliases(string $encoding) Parameters $encoding − The encoding type to check for aliases. This must be a valid encoding name recognized by the mbstring extension. Return Value Returns a numerically indexed array of encoding aliases on success, or false on failure. Errors/Exceptions If the encoding is ...

Read More

PHP – Encode string for MIME header using mb_encode_mimeheader()

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

In PHP, mb_encode_mimeheader() function is used to encode a string for MIME (Multipurpose Internet Mail Extensions) header. It encodes a given string by the MIME header encoding scheme, which is essential for email headers containing non-ASCII characters. Syntax string mb_encode_mimeheader( string $string, ?string $charset = null, ?string $transfer_encoding = null, string $newLine = "\r", int $indent = 0 ) Parameters The mb_encode_mimeheader() function accepts five parameters − $string − The string to ...

Read More
Showing 10131–10140 of 25,466 articles
Advertisements