C প্রোগ্রামের Constants ও Variables

Submitted by tushar pramanick on Mon, 02/25/2013 - 09:32

Constants and Variables

Constant এর value  কখনোই চেঞ্জ হয় না। অন্যদিকে  variable কে ব্যবহার করা হয় ভিন্ন ভিন্ন ভ্যালু কে দেখানোর জন্য ।

যেমন ধরো CD disc এবং পেনড্রাইভ। সিডি ডিস্ক এর মধ্যেে রাখা গানগুলিকে কখনোই চেঞ্জ করা যায় না কিন্তু পেনড্রাইভ এর মধ্যে রাখা গানগুলিকে মুছে দিয়ে আবার লেখা যায়। constant হল সিডি ডিস্ক এর মত are variable হল পেনড্রাইভ এর মত। variable এর value সর্বদাই চেঞ্জ করা যায়।

যেমন মনে করো

i = 1;

যেখানে symbol 1 constant কারণ একের ভ্যালু সর্বদাই এক । এবং symbol i কে assign করা হয়েছে constant 1 দিয়ে। অন্যভাবে বলা যায় i এর value one হবে যখন প্রোগ্রাম লাইনটি execute হবে।

 পরে  যদি অন্য কোন স্টেটমেন্ট দিয়ে আই এর value কে চেঞ্জ করা হয়, যেমন

i = 10;

এবার পরে program লাইনটি  execute করা হয় তাহলে  i  এর value  পরিবর্তন হয়ে 10 হবে । এক্ষেত্রে  i এর value  পরিবর্তন হল । যেহেতু  আই এর ভ্যালু প্রথমে ছিল 1 এবং পরে পরিবর্তিত হয়ে  10 হল  সেই জন্য  symbol i কে বলা হবে variable।

ওরে যখন কিছু প্রোগ্রামের উদাহরণ আলোচনা করা হবে তখন constant এবং variable এর ধারনা আরো পরিস্কার হবে।

Comments

Related Items

The if-else Statement

The if-else Statement

The if statement

The if statement

If life were a straight line, it would be very boring. The same thing is true for programming. It would be too dull if the statements in your program could only be executed in the order in which they appear.

Mathematical Functions in C

Mathematical Functions in C

Basically, the math functions provided by the C language can be classified into three groups:

    Trigonometric and hyperbolic functions, such as acos(), cos(), and cosh().

Changing Data Sizes

Changing Data Sizes

Enabling or Disabling the Sign Bit

Enabling or Disabling the Sign Bit

As you know, it's very easy to express a negative number in decimal. All you need to do is put a minus sign in front of the absolute value of the number. But how does the computer represent a negative number in the binary format?