Found 26504 Articles for Server Side Programming

Explain insertion of elements in linked list using C language

Sindhura Repala
Updated on 27-Jan-2025 15:37:10

3K+ Views

Linked List Representation Linked lists use dynamic memory allocation, allowing them to grow and shrink as needed. They are defined as a collection of nodes, each containing two parts: data and a link. A linked list is a linear data structure where each element is known as a node, is connected to the next one using pointers. Unlike arrays, elements of a linked list are stored in random memory locations. The representation of data, links, and linked lists is shown below − Representation of node - Representation of Linked List -      Insertion Insertion operations in a linked list ... Read More

Explain the evaluation of expressions of stacks in C language

Bhanu Priya
Updated on 06-Dec-2024 15:49:44

21K+ Views

Stack is a linear data structure, that allows elements to be added and removed in a last-in, first-out(LIFO). The main operations are − Push Pop Display The Push Operation A stack adds a new item on top. A stack overflow occurs when the stack is full and cannot specify more items. Given below is an algorithm for Push() − Check for stack overflow. if (top = = n-1) printf("stack over flow"); Otherwise, insert an element into the stack. top ++ a[top] = item The ... Read More

Explain the conversions of expressions of stacks in C language

Bhanu Priya
Updated on 21-Jun-2024 21:50:10

2K+ Views

Stack is a linear data structure, where data is inserted and removed only at one end.AlgorithmsGiven below is an algorithm for Push ( ) −Check for stack overflow.if (top = = n-1) printf("stack over flow");Otherwise, insert an element into the stack.top ++ a[top] = itemGiven below is an algorithm for Pop ( ) −Check for stack underflow.if (top = = -1) printf("stack under flow");Otherwise, delete an element from the stack.item = a[top] top --Given below is an algorithm for Display ( ) −if (top == -1) printf ("stack is empty");Otherwise, follow the below mentioned algorithm.for (i=0; i

Explain linear data structure queue in C language

Bhanu Priya
Updated on 24-Mar-2021 13:59:45

745 Views

Data structure is collection of data organized in a structured way. It is divided into two types as explained below −Linear data structure − Data is organized in a linear fashion. For example, arrays, structures, stacks, queues, linked lists.Nonlinear data structure − Data is organized in a hierarchical way. For example, Trees, graphs, sets, tables.QueueIt is a linear data structure, where the insertion is done at rear end and the deletion is done at the front end.The order of queue is FIFO – First In First OutOperationsInsert – Inserting an element into a queue.Delete – Deleting an element from the ... Read More

Explain C Error handling functions

Bhanu Priya
Updated on 24-Mar-2021 13:53:46

861 Views

File is collection of records or is a place on hard disk, where data is stored permanently.Operations on filesThe operations on files in C programming language are as follows −Naming the fileOpening the fileReading from the fileWriting into the fileClosing the fileSyntaxThe syntax for opening a file is as follows −FILE *File pointer;For example, FILE * fptr;The syntax for naming a file is as follows −File pointer = fopen ("File name", "mode");For example, fptr = fopen ("sample.txt", "r"); FILE *fp; fp = fopen ("sample.txt", "w");Error Handling in FilesSome of the errors in files are as follows −Trying to read beyond ... Read More

Explain fgetc() and fputc() functions in C language

Bhanu Priya
Updated on 21-Jun-2024 22:00:27

4K+ Views

File is collection of records or is a place on hard disk, where data is stored permanently.Operations on filesThe operations on files in C programming language are as follows −Naming the fileOpening the fileReading from the fileWriting into the fileClosing the fileSyntaxThe syntax for opening a file is as follows −FILE *File pointer;For example, FILE * fptr;The syntax for naming a file is as follows −File pointer = fopen ("File name", "mode");For example, fptr = fopen ("sample.txt", "r"); FILE *fp; fp = fopen ("sample.txt", "w");fgets( ) and fputs( ) functions fgets() is used for reading a string from a file.The ... Read More

Explain the functions putw() and getw() in C language

Bhanu Priya
Updated on 12-Feb-2025 12:13:31

13K+ Views

A file is a collection of data stored in secondary memory. Files are used to store information that programs can determine. A file represents a sequence of bytes, Whether it is a text file or a binary file. It is a collection of records or is a location on the hard disk where data is stored permanently. Operations on Files The operations on files in the C programming language are as follows − Naming the file Opening the file Reading from the file Writing ... Read More

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

Bhanu Priya
Updated on 06-Dec-2024 14:45:51

12K+ Views

A file is a collection of data stored in secondary memory. Files are used to store information that programs can determine. A file represents a sequence of bytes, whether it is a text file or a binary file. It is a collection of records or a location on the hard disk where data is stored permanently. Operations on Files The operations on files in the C programming language are as follows − Naming the file Opening the file Reading from the file Writing into ... Read More

Explain append mode operation of files in C language

Bhanu Priya
Updated on 24-Mar-2021 13:26:21

690 Views

File is collection of records or is a place on hard disk, where data is stored permanently.Need of filesEntire 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 your data from one computer to another without changes.By using C commands, we can access the files in different ways.Operations on filesThe operations on files in C programming language ... Read More

Difference Between Inline and Macro in C++

AmitDiwan
Updated on 24-Mar-2021 13:24:36

1K+ Views

In this post, we will understand the difference between inline and macro in C++.InlineIt is a function in C++.It is parsed by the compiler.It can be defined inside or outside the class.It evaluates the argument only once.The compiler may not convert all functions to ‘inline’ function and expand them all.The short functions that are defined inside the class are automatically made as inline functions.An inline function inside a class can access the data members of the class.Inline function can be terminated using curly brackets.It is easy to debug.This is because error checking is done during compilation.It binds all statements in ... Read More

Advertisements