Deletion of Head and Tail Element in Linked List using C

Bhanu Priya
Updated on 25-Mar-2021 08:26:11

521 Views

Linked lists use dynamic memory allocation i.e. they grow and shrink accordingly. It is collection of nodes.Node has two parts, which are data and link. These are explained below.Operations on linked listsThere are three types of operations on linked lists which are as follows −InsertionDeletionTraversingDeletionIdentify the node.Adjust the links in such a way that deallocation of the nodes does not make the list as unconnected components.Return/display element to delete.Deallocate the memory.Delete Head elementFollow the steps given below to delete a head element in C programming language.1. void del_head() 2. { 3. int x;    Node *temp; 4. if(Head==NULL) 5. { ... Read More

Scope of a Variable in C Language

Bhanu Priya
Updated on 25-Mar-2021 08:09:05

970 Views

Storage classes specify the scope, lifetime and binding of variables.To fully define a variable, one needs to mention not only its ‘type’ but also its storage class.A variable name identifies some physical location within computer memory, where a collection of bits are allocated for storing values of variable.Storage class tells us the following factors −Where the variable is stored (in memory or cpu register)?What will be the initial value of variable, if nothing is initialized?What is the scope of variable (where it can be accessed)?What is the life of a variable?ScopeScope defines the visibility of an object. It defines where ... Read More

C Program for Addition and Multiplication by 2 Using Bitwise Operations

Bhanu Priya
Updated on 25-Mar-2021 08:06:05

1K+ Views

Bitwise operators operate on bits (i.e. on binary values of on operand)OperatorDescription&Bitwise AND|Bitwise OR^Bitwise XORRight Shift-One's complementBitwise ANDaba & b000010100111Bitwise ORaba | b000011101111Bitwise XORaba ^ b000011101110ExampleFollowing is the C program for addition and multiplication by 2 with the help of bitwise operators − Live Demo#include main(){    int a;    printf("Enter a");    scanf("%d",&a);    printf("%d*2=%d ",a,a1); }OutputWhen the above program is executed, it produces the following output −Run 1: Enter a 45 45*2=90 45/2=22 Run 2: Enter a 65 65*2=130 65/2=32

C Program for Guessing the Number Game

Bhanu Priya
Updated on 25-Mar-2021 07:29:28

2K+ Views

ProblemIn a program a number is already initialized to some constant. Here, we have to ask the user to guess that number which is already in the program. For this, we need to provide some clues for every time the user entering the number.SolutionThe logic that is used to guess the number is as follows −do{    if(num==guess){       flag=0;    } else if(guess

Count Repeated Letters in a Sentence using C

Bhanu Priya
Updated on 25-Mar-2021 07:24:11

6K+ Views

ProblemWrite a program to count a letter, which is entered by the user at console. How many times that letter is repeated in a sentence need to be printed on screen by using strlen() function.SolutionThe logics we used to count a letter are as follows −Asking the user to enter a sentence at runtime.printf("Enter a sentence"); gets(str);Asking the user to enter a letter at runtime.printf("Enter a character to check how many times it is repeating"); scanf("%c", &c);The logic to count the letter in a sentence is as follows −for(i=0;iRead More

C Unconditional Jump Statements

Bhanu Priya
Updated on 25-Mar-2021 07:20:59

11K+ Views

C programming language allows jumping from one statement to another. It also supports break, continue, return and go to jump statements.breakIt is a keyword which is used to terminate the loop (or) exit from the block.The control jumps to next statement after the loop (or) block.break is used with for, while, do-while and switch statement.When break is used in nested loops then, only the innermost loop is terminated.The syntax for break statement is as follows −ExampleFollowing is the C program for break statement − Live Demo#include main( ){    int i;    for (i=1; i

Difference Between 3NF and BCNF

AmitDiwan
Updated on 25-Mar-2021 06:31:13

6K+ Views

In this post, we will understand the difference between 3NF and BCNF.3NFThere shouldn’t be any transitive dependency.There shouldn’t be any non-prime attribute that depends transitively on a candidate key.It is not as strong as BCNF.It has high redundancy.The functional dependencies are already present in INF and 2NF.It is easy to achieve.It can be used to achieve lossless decomposition.BCNFFor any relation A->B, ‘A’ should be a super key of that specific relation.It is stronger than 3NF.The functional dependencies are present in 1NF, 2NF and 3NF.It has low redundancy in comparison to 3NF.The functional dependencies may or may not be preserved.It is ... Read More

Difference Between MySQL and PostgreSQL

AmitDiwan
Updated on 25-Mar-2021 06:28:38

215 Views

In this post, we will understand the difference between MySQL and PostgreSQL.MySQLIt is a relational database management system.It is the product developed by Oracle Corporation.It is supported by Windows, Mac OS X, Linux, BSD, UNIX, z/OS, Symbian, AmigaOS.It can’t be extended.In this system, the phpMyAdmin tool gives the GUI.Mysqldump and XtraBackup provide backup in MySQL.It provides temporary table.It doesn’t provide a materialized view.It doesn’t provide Data Domain Object to the system.PostgreSQLIt is an object-relational database management system.It was developed by the Global Development Group.It is supported by Windows, Mac OS X, Linux and BSD but not by UNIX, z/OS, Symbian, ... Read More

Difference Between WHERE and HAVING Clause in SQL

AmitDiwan
Updated on 25-Mar-2021 06:10:10

4K+ Views

In this post, we will understand the difference between WHERE clause and HAVING clause in SQL.WHERE ClauseIt is used to filter the records from the table based on a specific condition.It can be used without the ‘GROUP BY’ clause.It can be used with row operations.It can’t contain the aggregate functions.It can be used with the ‘SELECT’, ‘UPDATE’, and ‘DELETE’ statements.It is used before the ‘GROUP BY’ clause if required.It is used with a single row function such as ‘UPPER’, ‘LOWER’.HAVING ClauseIt is used to filter out records from the groups based on a specific condition.It can’t be used without the ... Read More

Difference Between T-SQL and PL/SQL

AmitDiwan
Updated on 25-Mar-2021 06:05:23

1K+ Views

In this post, we will understand the difference between T-SQL and PL-SQL.T-SQLIt is a Microsoft product.It is known as Transact Structure Query language.It gives a high degree of control to the developers/programmers.It works its best, and provides good performance with Microsoft SQL server.It is easy.It is simple to understand.It allows the insertion of multiple rows into a table.This is done with the help of the ‘BULK INSERT’ statement.The ‘SELECT INTO’ statement is used in T-SQLIn this, the ‘NOT EXISTS’ clause can be used with the ‘SELECT’ statements.PL-SQLIt is an Oracle product.It is known as Procedural Language Structural Query Language.It is ... Read More

Advertisements