- 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)
1K+ Views
ProblemA laptop manufacturing company has the monthly compensation policy for their salespersons as mentioned below −Minimum base salary: 3000.00Bonus for every computer sold: 200.00Commission on the total monthly sales: 5 per centSince the prices of laptops are changing, the sales price of each laptop is fixed at the beginning of every month.SolutionThe logic for finding the bonus and commission is as follows −bonus = BONUS_RATE * quantity ; commission = COMMISSION * quantity * price ;The gross salary is calculated by using the formula given below −Gross salary = basic salary + (quantity * bonus rate) + (quantity * Price) ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
12K+ Views
Pointer is a variable that stores the address of another variable.Features of PointersPointer saves the memory space.The execution time of a pointer is faster because of the direct access to a memory location.With the help of pointers, the memory is accessed efficiently i.e. memory is allocated and deallocated dynamically.Pointers are used with data structures.Pointer declaration, initialization and accessingConsider the following statement −int qty = 179;In the memory, the variable can be represented as shown below −DeclarationDeclaring a pointer can be done as shown below −Int *p;It means ‘p’ is a pointer variable which holds the address of another integer variable.InitializationThe ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
1K+ Views
File is a collection of records (or) a place on hard disk where the data is stored permanently.By using C commands, we can access the files in different ways.Operations on filesGiven below are the operations which can be performed on files in the C programming language −Naming the fileOpening the fileReading from the fileWriting into the fileClosing the fileSyntaxThe syntax for opening and naming a file respectively is given below −FILE *File pointer;For example, FILE * fptr;File pointer = fopen (“File name”, “mode”);For example, fptr = fopen (“sample.txt”, “r”);FILE *fp; fp = fopen (“sample.txt”, “w”);The syntax for reading from file ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
83K+ Views
Sorting is the process of arranging the elements either in ascending (or) descending order.Types of sortingC language provides five sorting techniques, which are as follows −Bubble sort (or) Exchange SortSelection sortInsertion sort (or) Linear sortQuick sort (or) Partition exchange sortMerge Sort (or) External sortQuick sortIt is a divide and conquer algorithm.Step 1 − Pick an element from an array, call it as pivot element.Step 2 − Divide an unsorted array element into two arrays.Step 3 − If the value less than pivot element come under first sub array, the remaining elements with value greater than pivot come in second sub ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
7K+ Views
An array of characters is called a string.Given below is the declaration of a string −char stringname [size];For example, char string[50]; string of length 50 characters.InitializationUsing single character constant.char string[10] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ ,‘\0’}Using string constants.char string[10] = “Hello”:;AccessingThere is a control string “%s” used for accessing the string till it encounters ‘\0’.The logic we used to print the ASCII values of a given string at runtime is as follows −while(str[i]!='\0'){ printf("ASCII Value of %c = %d", str[i], str[i]); i++; }ExampleFollowing is the C program to print the ASCII values of a given string ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
4K+ Views
ProblemPrint the American Standard Code for Information Interchange (ASCII) values of 0 to 255 characters without initializing the character to integer type variable. Simply, use the format specifier.SolutionHere we are writing a program to print only from 65 to 122.If you want to see all ASCII values, in for loop you can write as follows −For(i=0;i
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
5K+ Views
ProblemRemove all the extra spaces from an entered string at runtime with the help of while loop by checking the spaces at each index of a character.SolutionConsider an example given below −It removes all the spaces from a given string. The given string is Tutorials Point C Programming. The result after removing spaces is TutorialsPointCProgramming.An array of characters is called a string.Given below is the declaration of a string −char stringname [size];For example, char string[50]; string of length 50 characters.InitializationUsing single character constant.char string[10] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ ,‘\0’}Using string constants.char string[10] = “Hello”:;AccessingThere is a control ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
3K+ Views
ProblemRemove all the spaces from an entered string at runtime with the help of while loop by checking spaces at each index of a character.SolutionConsider an example given below −It removes all the spaces from a given string. The given string is Tutorials Point C Programming. The result after removing spaces is TutorialsPointCProgramming.An array of characters is called a string.Given below is the declaration of a string −char stringname [size];For example, char string[50]; string of length 50 characters.InitializationUsing single character constant.char string[10] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ ,‘\0’}Using string constants.char string[10] = “Hello”:;AccessingThere is a control string “%s” ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
389 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