- 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
We know that functions can be called by value and called by reference.If the actual parameter should not change in called function, pass the parameter-by value.If the value of actual parameter should get changed in called function, then use pass-by reference.If the function has to return more than one value, return these values indirectly by using call-by-reference. Read Also: Function Call by Value in C and Function Call by Reference in C ExampleFollowing is the C program for the demonstration of returning the multiple values − Live Demo#include void main() { void areaperi(int, int*, int*); int r; float ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
989 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?BindingBinding finds the corresponding binding occurrence (declaration/definition) for an applied ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
5K+ 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?LifetimeThe lifetime of a variable defines the duration for which ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
739 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
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
878 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
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
35K+ Views
ProblemWrite a program to calculate the area of triangle, square, circle, rectangle and polygon by using the switch case.SolutionBased on case number, the area of triangle, square, circle, rectangle and polygon is calculated.The logic used to find area of triangle is as follows −Enter sides of a triangle a, b, cs=(float)(a+b+c)/2; area=(float)(sqrt(s*(s-a)*(s-b)*(s-c)));The logic used to find area of square is as follows −Enter the side of square at runtime.area=(float)side*side;The logic used to find area of circle is as follows −Enter the radius of circle at runtimearea=(float)3.14159*radius*radius;The logic used to find area of rectangle is as follows −Enter length and breadth ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
1K+ 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
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
5K+ 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
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
9K+ 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
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
2K+ Views
In C programming language, the Control statements are used to repeat a set of statements.They are as follows −for loopwhile loopdo-while loopIn for loop and while loop, the condition specifies the number of times, in which a loop can be executed.Example for the for loopfor (k = 1; k