Difference between For and While Loop in C

This C Tutorial explains the differences between the while and for loop in C. While Loop In while loop, condition is checked before execution of each iteration and as condition fails, loop terminates. While Loop Syntax   /* * In while, condition is tested in the beginning of each iteration */   while (condition) { … Read more

advertisement

Loops in C (For, While and Do-While Loop Statements)

This Tutorial explains various loops in C with example usage. A loop statement is one that repeatedly executes, ensuring a given condition to be true prior to execution of each iteration, to perform some computations/work. As the condition turns false, loop terminates. There are three types of loops in C programming language. While Loop For … Read more

advertisement

Difference between While and Do-while Loop in C

This C Tutorial explains the difference between While and Do-while Loop in C Programming. Do-while Loop in C In do-while loop, condition is always tested after the execution of the iteration and if condition fails, loop terminates. Therefore, do-while loop executes at least one iteration before termination if condition fails in first iteration! Do-while loop … Read more

advertisement

Conditional Statements in C Programming

This C Tutorial explains various conditional statements in C Language with example usage. What is Conditional Statement? Conditional statements in C are used to make decisions based on whether a condition is true or false. Conditional statements cause variable flow of execution of the same program, each time the program is run, based on certain … Read more

advertisement

Goto Statement in C

What is a goto statement in C Programming Language? The goto statement is a jump statement that transfers the program control to a label. The target of the jump is specified by a label, which must be declared beforehand. The label can be any valid identifier declared in the same function in which the goto … Read more

advertisement

Linkage, Scope of Variables and Functions in C

This C Tutorial explains Linkage/Scope of variables and functions in C with examples and defines the type of Linkages. Linkage of any variable and/or function defines the Area of the Program in which they are accessible. There are three types of Linkages for the variables & functions. These are as follows 1. EXTERNAL 2. INTERNAL … Read more

advertisement

Difference between Declaration and Definition of a Variable in C

Question: What is the difference between declaration and definition of a variable? Answer: Declaration specifies the properties of a variable. For example: int x; /* x is an integer */ int roll_no[]; /* roll_no is an array of integers */ Definition declares a variable and causes the storage to be allocated. For example: int x … Read more

advertisement

What is Dangling else in C?

This C Tutorial explains “Dangling else” in C. It explains the association of single else statement in a nested if statement. In nested if statements, when a single “else clause” occurs, the situation happens to be dangling else! For example: if (condition) if (condition) if (condition) else printf("dangling else!\n"); /* dangling else, as to which … Read more

advertisement

What Happens if the Conditional Expression is Missing in an if Statement?

Question: What is the output for the following code snippet? Will the program get compiled? If not, can you correct the condition in the if statement? if (;) printf("empty statement ; is considered true!"); else printf("empty statement ; is considered false"); Answer: COMPILATION ERROR! Well! if the empty statement ” ; ” in the if … Read more

advertisement

Runtime Stack in C with Examples

This C Tutorial explains run time stack in C with examples. Lets dig deeper into details in order to unfurl the essentials of “Run-Time Stack” rather simply defining what Stack is and where is it used? Well! If we try to recollect ours’ memory during studying in college, we will find the concept of Stack … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.