Server Side Programming Articles

Page 913 of 2109

What do you mean by odd loops in C language?

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

In C programming language, loops are used to repeat a set of statements. While traditional loops have known iterations, odd loops refer to loops where the number of iterations is unknown or determined by user input during runtime. These are also called indefinite loops. Syntax while (condition) { // statements // update condition based on user input } Understanding Odd Loops Odd loops are characterized by − Unknown number of iterations at compile time Loop termination depends on user input or runtime conditions Often ...

Read More

Explain insertion of elements in linked list using C language

Sindhura Repala
Sindhura Repala
Updated on 15-Mar-2026 3K+ Views

A linked list is a linear data structure where elements (called nodes) are stored in sequence, with each node containing data and a pointer to the next node. Unlike arrays, linked list elements are stored in non-contiguous memory locations and connected through pointers. Syntax struct node { int data; struct node *next; }; void insert_front(struct node **head, int value); void insert_end(struct node **head, int value); void insert_after(struct node *head, int value, int after); void insert_before(struct node **head, int value, int before); Linked List Representation Each ...

Read More

Explain the conversions of expressions of stacks in C language

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

Stack is a linear data structure where data is inserted and removed only at one end. Stacks are particularly useful for converting expressions between different notations like infix, prefix, and postfix. Stack Operations Before understanding expression conversions, let's review the basic stack operations − Push Operation Inserts an element at the top of the stack − if (top == n-1) printf("Stack overflow"); else { top++; stack[top] = item; } Pop Operation Removes and returns the top element from the stack − ...

Read More

Explain linear data structure queue in C language

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

A queue is a linear data structure that follows the First In First Out (FIFO) principle. In a queue, elements are inserted at the rear end and deleted from the front end, similar to a real-world queue where the first person to join the line is the first to be served. 10 20 30 40 FRONT REAR DELETE ...

Read More

Explain C Error handling functions

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

In C programming, error handling functions are essential for managing errors that occur during file operations. These functions help detect and report errors when reading from or writing to files, ensuring robust and reliable programs. Syntax int ferror(FILE *stream); void perror(const char *s); int feof(FILE *stream); Common File Operation Errors Some common errors in file operations include − Trying to read beyond the end of file Device overflow Trying to open an invalid file Performing invalid operations (e.g., writing to a read-only file) ferror() Function The ferror() function is ...

Read More

Explain putc() and getc() functions of files in C language

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

The putc() and getc() functions in C are used for character-based file input/output operations. These functions allow you to read and write single characters to files, making them useful for processing text files character by character. Syntax int putc(int ch, FILE *fp); int getc(FILE *fp); The putc() Function The putc() function writes a character to a file. It takes two parameters − the character to write and a file pointer. It returns the written character on success or EOF on failure. The getc() Function The getc() function reads a character from a ...

Read More

Explain append mode operation of files in C language

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

In C programming, append mode is a file opening mode that allows you to add new data to the end of an existing file without overwriting its current contents. When you open a file in append mode, the file pointer is automatically positioned at the end of the file. Syntax FILE *fp; fp = fopen("filename.txt", "a"); Where "a" represents the append mode. If the file doesn't exist, a new file will be created. If the file exists, new data will be added after the existing content. Key Features of Append Mode File ...

Read More

Explain read mode operation of files in C language

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

In C programming, file handling allows us to perform various operations on files stored on disk. The read mode operation is one of the fundamental file operations that enables us to access and retrieve data from existing files. Syntax FILE *file_pointer; file_pointer = fopen("filename", "r"); File Declaration and Opening in Read Mode To work with files in C, we first need to declare a file pointer and then open the file in read mode − FILE *fp; fp = fopen("filename.txt", "r"); The fopen() function returns a pointer to the file ...

Read More

Explain write mode operation of files in C language

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

File write mode in C is used to open a file for writing data. When a file is opened in write mode, you can store data permanently in the file, which persists even after the program terminates. Need of Files Entire data is lost when a program terminates. Storing in a file preserves the data even if the program terminates. If you want to enter a large amount of data, normally it takes a lot of time to enter them all. We can easily access the content of files by using few commands. You can easily move ...

Read More

How to separate even and odd numbers in an array by using for loop in C language?

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

In C programming, separating even and odd numbers from an array is a common operation that involves checking each element's divisibility by 2. This process uses the modulus operator (%) to determine if a number leaves a remainder when divided by 2. Syntax // Check if number is even if (number % 2 == 0) { // number is even } // Check if number is odd if (number % 2 != 0) { // number is odd } Algorithm The logic to ...

Read More
Showing 9121–9130 of 21,090 articles
« Prev 1 911 912 913 914 915 2109 Next »
Advertisements