Fundamentals - III
Fundamentals - III
To alter normal flow of a Loop
To alter normal flow of a Loop
Break
"break" is a keyword used in programming languages like C, C++, Java, and Python to exit or terminate a loop prematurely. When the "break" statement is encountered within a loop structure (such as "for" or "while" loops), the execution of t...
For Loops in Fundamentals
For Loops in Fundamentals
What is a "for" loop?
A "for" loop is a control flow statement in programming that allows you to repeatedly execute a block of code based on a specific condition. It provides a compact way to initialize variables, define the loop condition, and u...
Scope of a Variable | Lifetime and Visibility
Scope of a Variable | Lifetime and Visibility
What is the scope of a variable?
The scope of a variable refers to the region or portion of the program where the variable is visible and can be accessed. It defines the lifetime and visibility of the variable within the program.
**Relevance of ...
Global Variables
Global Variables
What is it?
A global variable is a variable that is accessible throughout the entire program, from any function or class. It is defined outside of any function or class and can be accessed by multiple functions or classes.
How to create?
T...
cin vs cin.get()
cin vs cin.get()
cin:
Syntax:
cin >> variable;
Code:
#include
using namespace std;
int main() {
int num;
cout << "Enter a number: ";
cin >> num;
cout << "You entered: " << num << endl;
return 0;
...
Other Language Constructs - do while
Other Language Constructs - do while
The "do-while" loop is a control flow statement that executes a block of code repeatedly until a specified condition becomes false. Unlike the "while" loop, it checks the condition after executing the loop body, ensuring that the loop is executed at l...
Other Language Constructs - switch case
Other Language Constructs - switch case
The "switch-case" statement is a control flow statement used for multi-way branching. It provides a way to select one of many possible execution paths based on different cases or values of a variable or an expression.
Syntax:
switch (expression)...
Other Language Constructs - Tertiary Operator ( ? : )
Other Language Constructs - Tertiary Operator ( ? : )
The tertiary operator, also known as the conditional operator, is a shorthand way of expressing a simple if-else statement. It allows you to assign a value or execute an expression based on a condition. The operator consists of a question mark (?) and...
Library
WEB DEVELOPMENT
FAANG QUESTIONS