Expressions and Statements in C language

Introduction

जब हम C language में program लिखते हैं, तो हम instructions देते हैं जिन्हें computer step-by-step execute करता है।

ये instructions दो मुख्य भागों में होते हैं:

  • Expressions (जहाँ calculation या operation होता है)
  • Statements (जो एक complete instruction होते हैं)

इन दोनों को समझना programming की logic बनाने के लिए बहुत जरूरी है।

Expressions

Definition

Expression values, variables और operators का combination होता है जो एक result produce करता है।

Example

int a = 10, b = 5;
int c = a + b;

यहाँ:

  • a + b → expression है
  • इसका result = 15

Real World Example

मान लो आप shopping कर रहे हैं:

  • Price = 100
  • Discount = 20

Final price निकालना (100 – 20) = 80

यह calculation एक expression की तरह है।

Statements

Definition

Statement एक complete instruction होता है जो compiler द्वारा execute किया जाता है और यह semicolon (;) पर समाप्त होता है।

Example

int a = 10;
a = a + 5;
printf("%d", a);

हर line एक statement है

Types of Statements

  1. Declaration Statement
int a;
  1. Assignment Statement
a = 10;
  1. Control Statement
if (a > 5)
{
printf("Greater");
}

Real World Example

मान लो आप किसी को instructions दे रहे हैं:

  1. उठो
  2. पानी पियो
  3. स्कूल जाओ

हर instruction एक complete step है
इसी तरह programming में हर statement एक complete instruction होता है।

Difference Between Expression and Statement

ExpressionStatement
Result produce करता हैInstruction execute करता है
Operators + values का combinationComplete line of code
Example: a + bExample: a = a + b;

Exam Points

  • Expression हमेशा एक value return करता है
  • Statement एक complete instruction होता है
  • हर statement semicolon (;) से खत्म होता है (except control blocks)
  • Expression statement का हिस्सा हो सकता है

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top