Programming Articles

Page 931 of 2547

Deletion of head and tail element logic in a linked list using C language.

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

In C programming, deleting head and tail elements from a linked list are fundamental operations that require careful pointer manipulation to maintain list integrity. A linked list is a dynamic data structure where each node contains data and a pointer to the next node. Syntax // Delete head node void deleteHead(); // Delete tail node void deleteTail(); Node Structure First, let's define the basic node structure for our linked list − Data Next Node Structure ...

Read More

Explain the pointers for inter-function communication in C language.

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

Pointers enable inter-function communication in C by allowing functions to modify variables in the calling function's scope. This is essential for pass-by-reference behavior and returning multiple values from a single function. Syntax // Function declaration with pointer parameters return_type function_name(data_type *pointer_param); // Function call passing address function_name(&variable); Key Concepts Pass-by-value: Function receives a copy of the variable's value Pass-by-reference: Function receives the address of the variable using pointers Multiple return values: Use pointers to modify multiple variables in the calling function Example: Returning Multiple Values The following program demonstrates ...

Read More

Explain scope of a variable in C language.

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

In C programming, the scope of a variable defines where in the program that variable can be accessed or referenced. Variable scope determines the visibility and accessibility of variables throughout different parts of your program. Syntax // Global scope data_type variable_name; int main() { // Local scope data_type variable_name; return 0; } Types of Variable Scope C language supports two main types of variable scope − Local Scope: Variables declared inside a function or block are only accessible within ...

Read More

C program for Addition and Multiplication by 2 using Bitwise Operations.

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

Bitwise operators in C operate directly on bits (binary representation) of operands. They are highly efficient for arithmetic operations like multiplication and division by powers of 2. The left shift () operators can perform these operations faster than traditional arithmetic operators. Syntax // Multiplication by 2 result = number > 1; Bitwise Operators Overview Operator ...

Read More

C program to print area of triangle, square, circle, rectangle and polygon using switch case.

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

This C program calculates the area of different geometric shapes using a switch case statement. The program provides a menu−driven interface where users can select from triangle, square, circle, rectangle, and parallelogram area calculations. Syntax switch (expression) { case constant1: // statements break; case constant2: // statements break; default: ...

Read More

Write a C program for guessing the number game.

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

A number guessing game is a classic programming exercise where the computer has a secret number and the user must guess it. The program provides hints after each guess, telling whether the guess is too high or too low, until the correct number is found. Syntax do { if (guess == secretNumber) { // Correct guess - exit loop } else if (guess < secretNumber) { // Give "too low" hint ...

Read More

C program to count a letter repeated in a sentence.

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

In C programming, counting the frequency of a specific character in a string is a common task. This program prompts the user to enter a sentence and a character, then counts how many times that character appears in the sentence using strlen() function for string length determination. Syntax for(i = 0; i < strlen(string); i++) { if(string[i] == character) { count++; } } Algorithm The logic to count character frequency involves the following steps − Read ...

Read More

What is C unconditional jump statements?

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

C programming language provides unconditional jump statements that allow transferring control from one part of the program to another without evaluating any condition. The four main unconditional jump statements are break, continue, return, and goto. break Statement The break statement is used to terminate loops or exit from switch blocks immediately. When executed, control jumps to the statement following the loop or block. Syntax break; Example The following program demonstrates the break statement in a loop − #include int main() { int i; for (i = 1; i

Read More

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
Showing 9301–9310 of 25,466 articles
« Prev 1 929 930 931 932 933 2547 Next »
Advertisements