Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Server Side Programming Articles
Page 919 of 2109
How to delete the vowels from a given string using C language?
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 MoreHow to use Pre-defined mathematical function in C language?
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 MoreWhat are the input and output for strings in C language?
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 MoreExplain the END OF FILE (EOF) with a C Program
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 MoreHow to access an array element in C language?
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 MoreWhat do you mean by buffer in C language?
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 MoreWhat are Backslash character constants in C language?
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 MoreExplain the constant type qualifier in C language
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 MoreDecimal to Binary conversion using C Programming
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 MoreC Program to print the sum of boundary elements of a matrix
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