Bhanu Priya

Bhanu Priya

1,060 Articles Published

Articles by Bhanu Priya

Page 13 of 106

What do you mean by buffer in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 11K+ Views

A buffer in C is a temporary storage area that holds data before it is processed. All input/output (I/O) devices contain I/O buffers to manage data flow efficiently. When you provide more input values than required, the extra values remain stored in the input buffer. This buffered data automatically gets consumed by the next input operation if one exists. Understanding and managing buffers is crucial for preventing unexpected behavior in C programs. Syntax int fflush(FILE *stream); void flushall(void); /* Non-standard, compiler-specific */ Example: Buffer Behavior Demonstration The following program demonstrates how input ...

Read More

What are Backslash character constants in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 5K+ Views

A backslash (\) introduces an escape sequence that allows visual representation of non-graphic characters. Escape sequences are character combinations that have special meaning in C programming. One of the most common escape sequences is the newline character (), which moves the cursor to the beginning of the next line. Syntax \character Backslash Character Constants The following table shows commonly used backslash character constants − Character Meaning Description '\a' Alert (Bell) Produces an audible alert '\b' Backspace Moves cursor back one position ...

Read More

Explain the constant type qualifier in C language

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 279 Views

Type qualifiers add special attributes to existing datatypes in C programming language. The const type qualifier is used to make variables read-only, preventing their modification after initialization. Type Qualifiers in C const volatile restrict Read-only variables Prevents compiler ...

Read More

Decimal to Binary conversion using C Programming

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 4K+ Views

Decimal to binary conversion is a fundamental concept in computer programming. In C, we can convert decimal numbers to their binary representation using simple mathematical operations and functions. Syntax long decimalToBinary(int decimal_number); Method 1: Using Function with Mathematical Approach This method uses modulo and division operations to extract binary digits and build the binary number − #include long decimalToBinary(int dno) { long bno = 0, rem, f = 1; while (dno != 0) { ...

Read More

C Program to print the sum of boundary elements of a matrix

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 6K+ Views

In C programming, finding the sum of boundary elements of a matrix involves identifying elements that are on the first row, last row, first column, or last column. Boundary elements form the outer edge of the matrix. Syntax for(i = 0; i < rows; i++){ for(j = 0; j < cols; j++){ if(i == 0 || i == rows-1 || j == 0 || j == cols-1){ // This is a boundary element ...

Read More

C program to calculate power of a given number

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 19K+ Views

In C programming, calculating the power of a number means multiplying the base number by itself for a specified number of times (exponent). For example, 34 = 3 × 3 × 3 × 3 = 81. We can implement this using loops or the built-in pow() function. Syntax // Manual calculation using loop result = base^exponent // Using pow() function #include double pow(double base, double exponent); Method 1: Using While Loop This approach uses a while loop to multiply the base value repeatedly − #include int main() { ...

Read More

C Program to find minimum occurrence of character in a string

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 2K+ Views

In C programming, finding the minimum occurrence of a character in a string involves counting the frequency of each character and then determining which character appears the least number of times. Syntax char string[SIZE]; int frequency[CHARS]; // Count frequency of each character // Find character with minimum frequency String Declaration and Initialization Before finding minimum occurrence, let's understand string basics − Declaration: char stringname[size]; For example − char string[50]; creates a string of length 50 characters. Initialization: Using single character constants − char string[10] ...

Read More

What is strrev() Function in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 4K+ Views

In C programming, the strrev() function is used to reverse a string in-place. However, strrev() is not part of the standard C library — it is a Microsoft-specific extension found in some compilers. For portable code, we need to implement string reversal manually. Syntax char* strrev(char* str); Where str is the string to be reversed. The function returns a pointer to the reversed string. Example 1: Manual String Reversal Using Two Pointers Since strrev() is not standard, here's how to reverse a string using a custom function − #include #include ...

Read More

Explain scope rules related to the functions in C language

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 894 Views

Scope rules in C programming determine the accessibility, lifetime, and boundary of variables within different parts of a program. Understanding scope is crucial for proper variable management and avoiding naming conflicts. Syntax // Local variable declaration return_type function_name() { data_type local_variable; // Local scope } // Global variable declaration data_type global_variable; // Global scope return_type function_name() { // Function body } Function Scope Rules Scope rules related to functions follow these principles − Local Variables: Variables declared within a ...

Read More

What are the predefined functions in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 11K+ Views

In C programming, functions are classified into two main types − Predefined functions (Library functions) User-defined functions Predefined functions are pre-written functions available in C standard libraries. They provide ready-to-use functionality for common programming tasks, helping developers write efficient and error-free code. Syntax #include return_type function_name(parameters); Key Features of Predefined Functions Already defined in system libraries Tested and optimized for performance Reduce development time and effort Require appropriate header file inclusion Follow standard syntax and conventions Common Mathematical Functions The math.h library provides various mathematical ...

Read More
Showing 121–130 of 1,060 articles
« Prev 1 11 12 13 14 15 106 Next »
Advertisements