statement in c | types of statement| programming principles and algorithm| sem 1 |

preview_player
Показать описание
In C programming, a statement is a complete instruction that performs a specific action. Statements are the building blocks of a C program, and they are executed sequentially, one after another. Here are some common types of statements in C:

1. **Expression Statement:**
- An expression statement consists of an expression followed by a semicolon (;). It evaluates the expression and discards the result. For example:

```c
x = 5 + 3; // Expression statement
```

2. **Declaration Statement:**
- A declaration statement declares variables. It typically includes the data type and variable names. For example:

```c
int age; // Declaration statement for an integer variable
```

3. **Assignment Statement:**
- An assignment statement assigns a value to a variable. It uses the assignment operator (=). For example:

```c
age = 25; // Assignment statement
```

4. **Control Flow Statements:**
- These statements control the flow of the program. They include:
- **Conditional Statements:** `if`, `else if`, `else`, `switch`
- **Loop Statements:** `for`, `while`, `do...while`
- **Jump Statements:** `break`, `continue`, `return`, `goto` (though `goto` is rarely used and not recommended)

5. **Function Calls:**
- A function call statement invokes a function. For example:

```c
printf("Hello, World!"); // Function call statement
```

6. **Empty Statement:**
- An empty statement consists of just a semicolon (;) and does nothing. It's used to indicate a null statement or as a placeholder. For example:

```c
; // Empty statement
```

7. **Compound Statement (Block):**
- A compound statement, also known as a block, groups multiple statements together within curly braces {}. It's used to create a scope for local variables and to organize code. For example:

```c
{
int localVar = 42; // Declaration and assignment within a compound statement
// Other statements
}
```

These are the fundamental types of statements in C. They are combined to create more complex programs and define the logic and behavior of the program. Statements are executed sequentially, except when control flow statements alter the normal execution flow based on conditions or loops.
by bca wali dost
History and introduction of c program
Structure of c program.
Global and local declaration
User defined, library function, function as a building block.
Principal of management part 1
Principal of management part 2
Programming principal algorithm part 4
Programming principal and algorithm part 5
Business communication part 1
Business communication part 2
Business communication part 3

#bca #programming #cprogramming #statement #ytviral
Рекомендации по теме
Комментарии
Автор

Important questions bta do exams k liye please im from ccsu University

dbgaming
welcome to shbcf.ru