Posts

Showing posts from May, 2022

Use of Backslash "\n" in C language

 Why  Backslash "n" is used in "printf" in machine languages Answer: Backslash "\n" is used in many programming languages. It is called as newline character. We use Backslash "\n" to bring a newline in our output . This newline character is a type of escape sequence . This helps the programmer or the coder to display the output with an alignment . It also help others to see and understand  the output clearly. The Backslash "\n" is used only in "printf" statements There are also other escape sequence characters like "\t" . "\t" is use for tab space . It...

"int" in C language |Use of "int" in C|

Image
 Do we need to use integer data type in "C" even if we don't need it? Answer:  No, integer data type is a type widely used in  C and other programming languages. we use a generally a data type to declare any variable For Example: int a,b; From the above example you can see "int" which represents "integer datatype" , and "a", "b" are two variables that are declared in integer type. Integer data type generally takes 16,32,64 bits of space depending on the machine . Integer data type is used to represent integer values ("23").  There are also other data types like "float data type", "char", "string", "boolean" etc., If you don't need integer data type in your program you can skip using it. But remember without declaring the variable ...

Linked list |C program to implement insertion, deletion and displaying using|

Image
 C program to implement insertion, deletion and displaying using Linked list Code: #include <stdio.h> #include <stdlib.h> struct node {   int data;   struct node *link; }; struct node *head_node, *first_node, *temp_node = 0, *prev_node; void insert(); void display(); void del(); int count(); int x; void main() {   int option;   while (1)   {     printf("\nOperations\n");     printf("1. Insert into Linked List \n");     printf("2. Delete from Linked List \n");     printf("3. Display Linked List\n");     printf("4. Count Linked List\n");     printf("5. Exit\n");     printf("\nchoose option: ");     scanf("%d", &option);     switch (option)     {       case 1: insert(); break;       case 2: del(); break;       case 3: displ...