karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 49 of 143

calloc() versus malloc() in C

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

In C, both malloc() and calloc() are used for dynamic memory allocation, but they have important differences in initialization and usage. Understanding when to use each function is crucial for effective memory management. Syntax void *malloc(size_t size); void *calloc(size_t number, size_t size); malloc() Function The malloc() function allocates a block of memory of the specified size in bytes. It does not initialize the allocated memory, leaving it with garbage values. Parameters size − Size of memory block to allocate in bytes Example #include #include ...

Read More

strxfrm() in C/C++

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 395 Views

The strxfrm() function transforms a source string according to the current locale's collating sequence and copies the transformed string to a destination buffer. It is declared in header file and is useful for locale-sensitive string comparisons. Syntax size_t strxfrm(char *destination, const char *source, size_t number); Parameters destination − Pointer to the destination buffer where transformed characters will be copied source − Pointer to the null-terminated source string to be transformed number − Maximum number of characters to copy to destination Return Value Returns the length of the transformed string ...

Read More

strcspn() in C

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 404 Views

The strcspn() function in C counts the number of characters in the initial segment of a string that do not match any character from a second string. It is declared in the string.h header file and returns the length of the initial segment of the first string before the first occurrence of any character from the second string. Syntax size_t strcspn(const char *string1, const char *string2); Parameters: string1 − The string to be scanned string2 − The string containing characters to search for in string1 Return Value: Returns the number of characters ...

Read More

isgreater() in C/C++

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 381 Views

In C programming, the isgreater() function is a type-generic macro used to compare two floating-point values safely. It is declared in the header file and returns a non-zero value (true) if the first argument is greater than the second, otherwise returns 0 (false). Unlike the regular > operator, isgreater() never raises floating-point exceptions. Syntax int isgreater(x, y); Parameters: x − First floating-point value to compare y − Second floating-point value to compare Return Value: Returns 1 if x is greater than y, otherwise returns 0. Example 1: Basic Usage with ...

Read More

strdup() and strdndup() in C/C++

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

The functions strdup() and strndup() are used to duplicate strings in C. These functions allocate memory dynamically and create copies of existing strings. Note that these are POSIX functions, not part of the C standard library. Note: To use strdup() and strndup(), you may need to compile with -D_GNU_SOURCE flag or ensure your system supports POSIX extensions. strdup() Function The strdup() function duplicates an entire string by allocating memory and copying the string content. Syntax char *strdup(const char *string); Parameters string − Pointer to the null-terminated string to ...

Read More

Float and Double in C

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

In C programming, float and double are data types used to represent floating point numbers. Both follow the IEEE 754 standard but differ in precision and memory usage. Float Data Type Float is a 32-bit IEEE 754 single precision floating point number with the following structure − 1 bit for the sign 8 bits for the exponent 23 bits for the mantissa (fractional part) Precision: 6-7 decimal digits Syntax float variable_name; Example: Float Declaration and Usage #include int main() { float x ...

Read More

"register" keyword in C

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

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 More

How to add auto-increment to column in MySQL database using PhpMyAdmin?

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

You can add auto_increment to a column in MySQL database with the help of ALTER command. The syntax is as follows − ALTER TABLE yourTableName MODIFY yourColumnName INT NOT NULL AUTO_INCREMENT; Using PhpMyAdmin To open PhpMyAdmin on localhost, you need to type the following URL in your browser − localhost/phpmyadmin The PhpMyAdmin interface appears as follows − phpMyAdmin Database: AutoIncrementDemo Table: AutoIncrementDemo Field: UserId | Type: INT | Primary Key ...

Read More

IntlChar getUnicodeVersion() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 72 Views

The IntlChar getUnicodeVersion() function is used to get the Unicode version that the ICU library is using. It returns an array containing version numbers that represent the Unicode standard version. Syntax array IntlChar::getUnicodeVersion() Parameters This function takes no parameters. Return Value The IntlChar getUnicodeVersion() function returns an array containing four integers representing the Unicode version number in the format [major, minor, micro, update]. Example The following example demonstrates how to get the Unicode version ? The output of the above code is ? ...

Read More

IntlChar getBidiPairedBracket() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 89 Views

The IntlChar::getBidiPairedBracket() function returns the paired bracket character for a given Unicode character. This function is useful when working with bidirectional text processing where you need to find the matching bracket for proper text rendering. Syntax IntlChar::getBidiPairedBracket(mixed $codepoint) Parameters codepoint − An integer codepoint value or a character encoded as a UTF-8 string. Return Value Returns the mapped paired bracket character as a string, or the original character if no paired bracket exists. Returns NULL for invalid input. Example The following example demonstrates how to find paired brackets ...

Read More
Showing 481–490 of 1,421 articles
« Prev 1 47 48 49 50 51 143 Next »
Advertisements