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 912 of 2109
C Program to print all ASCII values.
ASCII (American Standard Code for Information Interchange) is a character encoding standard that assigns numeric values to characters. In C programming, we can print ASCII values of characters using format specifiers without explicitly converting characters to integers. Syntax printf("%c \t %d", i, i); Method 1: Printing ASCII Values from A to z (65 to 122) This example prints ASCII values for uppercase letters, special characters, and lowercase letters − #include int main() { int i; printf("Character \t ASCII Value"); // Print ASCII values from A to z for (i = 65; i = 32 && i
Read MoreC program to remove spaces in a sentence using string concepts.
In C, removing spaces from a string involves iterating through the string and eliminating space characters. This can be accomplished using string manipulation techniques where we shift characters to overwrite spaces. Syntax while(string[i] != '\0') { if(string[i] == ' ') { // Shift characters left to remove space } i++; } String Declaration and Initialization An array of characters is called a string. Given below is the declaration of a string − ...
Read MoreDeletion of head and tail element logic in a linked list using C language.
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 MoreExplain the pointers for inter-function communication in C language.
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 MoreExplain scope of a variable in C language.
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 MoreC program for Addition and Multiplication by 2 using Bitwise Operations.
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 MoreC program to print area of triangle, square, circle, rectangle and polygon using switch case.
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 MoreWrite a C program for guessing the number game.
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 MoreC program to count a letter repeated in a sentence.
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 MoreWhat is C unconditional jump statements?
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