C Articles

Page 20 of 96

How to calculate the volume of a sphere using C programming language?

Mandalika
Mandalika
Updated on 15-Mar-2026 7K+ Views

The volume of a sphere is the amount of space enclosed within the sphere. In C programming, we can calculate this using the mathematical formula for sphere volume. Syntax volume = (4.0/3.0) * π * radius³ Where π (pi) ≈ 3.14159 and radius is the distance from the center to any point on the sphere's surface. Algorithm Step 1: Enter radius of sphere at runtime Step 2: Apply the formula to variable Volume = (4/3) * π * radius³ Step 3: Print the volume ...

Read More

Explain reference and pointer in C programming?

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

In C programming, pointers are variables that store memory addresses of other variables. C does not have references like C++ − it only has pointers for indirect access to variables. Syntax datatype *pointer_name; pointer_name = &variable_name; Pointers in C Pointers store the memory address of another variable They can hold NULL values They enable pass by reference functionality They can be declared without initialization Use * operator to access the value at the address (dereference) Use & operator to get the address of a variable Example: Basic Pointer Operations This ...

Read More

Limitations of C programming language

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

C programming language, despite being powerful and widely used, has several limitations when compared to modern programming languages. Understanding these limitations helps developers choose the right language for their projects. Key Limitations of C Programming 1. No Object-Oriented Programming Support C does not support object-oriented programming concepts like inheritance, polymorphism, encapsulation, and data abstraction. This makes it difficult to model real-world problems effectively. 2. No Runtime Error Detection C compiles the entire program before checking for errors, rather than detecting errors line by line. This can make debugging more challenging compared to interpreted languages. ...

Read More

How to delete the vowels from a given string using C language?

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

In C, removing vowels from a string involves iterating through each character and shifting non-vowel characters to form a new string without vowels. This can be accomplished by checking each character against the vowel set and either skipping or keeping it. Syntax for(i=0; i

Read More

How to use Pre-defined mathematical function in C language?

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

In C programming, pre-defined mathematical functions are available in the math.h header file. These functions provide various mathematical operations like power, square root, trigonometric calculations, logarithms, and more. They help perform complex mathematical calculations easily without implementing the logic from scratch. Syntax #include double function_name(double argument); Common Mathematical Functions Here are some commonly used mathematical functions − Function Description Example pow(x, y) Returns x raised to power y pow(2, 3) = 8.0 sqrt(x) Returns square root of x sqrt(16) = 4.0 cbrt(x) Returns cube ...

Read More

What are the input and output for strings in C language?

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

An array of characters (or) collection of characters is called a string. In C programming, strings are null-terminated character arrays that end with the special character '\0'. Syntax // Input functions for strings scanf("%s", string_name); fgets(string_name, size, stdin); // Output functions for strings printf("%s", string_name); puts(string_name); Method 1: Using scanf() and printf() The scanf() function reads strings until it encounters whitespace, while printf() displays the complete string − #include int main() { char name[30]; printf("Enter your name: "); ...

Read More

Explain the END OF FILE (EOF) with a C Program

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

The End of File (EOF) is a special marker that indicates the end of input or when there are no more characters to read from a file or input stream. In C, EOF is typically defined as −1 and is returned by input functions when they reach the end of a file or encounter an error. Syntax EOF How EOF Works When reading from files or standard input, functions like getchar(), fgetc(), and getc() return EOF when they reach the end of the input stream. On Windows, pressing Ctrl+Z generates EOF, while on Unix/Linux ...

Read More

How to access an array element in C language?

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

An array is a group of related data items that share a common name. A particular value in an array is identified by using its "index number" or "subscript". The advantage of an array is the ability to use a single name to represent a collection of items and to refer to an item by specifying the item number, enabling the development of concise and efficient programs. Syntax datatype array_name[size]; array_name[index] = value; // Assigning value variable = array_name[index]; // Accessing value Where index starts from 0 and goes up to (size-1). ...

Read More

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
Showing 191–200 of 953 articles
« Prev 1 18 19 20 21 22 96 Next »
Advertisements