- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1401 Articles for C
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
2K+ Views
Stack over flow and stack under flow can be avoided by allocating memory dynamically.Operations carried out under stack in C programming language are as follows −PushPopPushFollowing is the basic implementation of a linked list −&item = 10 newnode = (node*) malloc (sizeof (node)); newnode ->data = item; newnode ->link = NULL; newnode ->link = start; start = newnode;popThe syntax is as follows −Syntaxif (start = = NULL) printf("Deletion is not possible.List is empty") else{ temp = start; start = start link; free (temp); }ProgramFollowing is the C program for stack by using linked lists −#include #include ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
510 Views
Linked lists use dynamic memory allocation i.e. they grow and shrink accordingly. They are defined as a collection of nodes. Here, nodes have two parts, which are data and link. The representation of data, link and linked lists is given below −Operations on linked listsThere are three types of operations on linked lists in C language, which are as follows −InsertionDeletionTraversingDeletionConsider an example given below −Delete node 2Delete node 1Delete node 3ProgramFollowing is the C program for deletion of the elements in linked lists − Live Demo#include #include struct Node{ int data; struct Node *next; }; void ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
5K+ 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. Also Read: Data Structures and Types Queue Queue 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 ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
3K+ 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. Read Also: Data Structures and Types Queue Queue is a linear data structure, where the insertion is done at rear end ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
761 Views
ProblemSort the names given by the user at runtime in an alphabetical order by using the bubble sort technique.SolutionThe logic used to print the names in alphabetical order is as follows −for (i=1; i < ITEMS; i++){ for (j=1; j 0){ /* Exchange of contents */ strcpy (dummy, string[j-1]); strcpy (string[j-1], string[j]); strcpy (string[j], dummy ); } } }ExampleFollowing is the C program to sort the names in an alphabetical order by using the string functions − Live Demo#define ITEMS 5 #define MAXCHAR ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
5K+ Views
Standard deviation is used to measure deviation of data from its mean. The mathematical formula to calculate the standard deviation is as follows −$$s=\sqrt{Variance}$$whereVariance$$=\frac{1}{n}\:\:\displaystyle\sum\limits_{i=1}^n (x_{i}-m)^{2}$$and$$m=mean=\frac{1}{n}\:\displaystyle\sum\limits_{i=1}^n x_{i}$$AlgorithmRefer an algorithm given below to calculate the standard deviation for the given numbers.Step 1 − Read n items.Step 2 − Calculate sum and mean of the items.Step 3 − Calculate variance.Step 4 − Calculate standard deviation.The logic used in the program for calculating standard deviation is as follows −for (i = 1 ; i
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
15K+ Views
If the elements of the list are arranged in order, then, the middle value which divides the items into two parts with equal number of items on either side is called the median.Odd numbers of items have just one middle value whereas; even numbers of items have two middle values.The median for even number of items is therefore, designated as the average of the two middle values.AlgorithmRefer an algorithm given below to calculate the median.Step 1 − Read the items into an array while keeping a count of the items.Step 2 − Sort the items in increasing order.Step 3 − ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
746 Views
ProblemWrite a program to print the multiplication table from 1 x 1 to 12 x 10 as given below −1 2 3 4 5 6 7 8 9 10 2 4 6 8 ……………….20 3 6 9…………………….30 4 8 12 16……………..40 - - - 12 24……………………..120SolutionUse two do while loops in nested form to display the multiplication table.The logic used to display the multiplication table is as follows −Inner loop is controlled by the variable column and is executed 10 times, whenever each time the outer loop is executed.Outer loop is executed 12 times and controlled by variable row.do /*......OUTER LOOP BEGINS........*/{ column = 1; do /*.......INNER LOOP BEGINS.......*/{ y = row * column; printf("%4d", y); column = column + 1; } while (column
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
481 Views
ProblemA personal system is sold at different costs by the vendors.Let’s take the list of costs (in hundreds) quoted by some vendors −25.00, 30.50, 15.00, 28.25, 58.15, 37.00, 16.65, 42.00 68.45, 53.50SolutionCalculate the average cost and range of values.The difference between the highest and the lowest values in the series is called range Hence, Range = highest value - lowest value.Now, find the highest and the lowest values in the series.ExampleFollowing is the C program to calculate the range of values and average cost of a personal system − Live Demo#include main(){ int count; float value, high, low, sum, ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
15K+ Views
An algorithm is given below to explain the process which is included in the C programming language to print the characters and strings in different formats.Step 1: Read a character to print.Step 2: Read a name at compile time.Step 3: Output of characters in different formats by using format specifiers.printf("%c%3c%5c", x, x, x);printf("%3c%c", x, x);printf("");Step 4: Output of strings in different formats by using format specifiers.printf("%s", name);printf("%20s", name);printf("%20.10s", name);printf("%.5s", name);printf("%-20.10s", name);printf("%5s", name);ExampleFollowing is the C program to print the characters and strings in different formats − Live Demo#include main(){ char x = 'T'; static char name[20] = "Tutorials Point"; ... Read More