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

Question and Answer

Question and Answer

    Q Which bit can be used as the sign bit in an integer?

Exercises : Answer the following Question

To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.

Measuring Data Sizes

Measuring Data Sizes

What Does x?y:z Mean?

What Does x?y:z Mean?

In C, ?: is called the conditional operator, which is the only operator that takes three operands. The general form of the conditional operator is

Using Shift Operators

Using Shift Operators

There are two shift operators in C. The >> operator shifts the bits of an operand to the right; the << operator shifts the bits to the left.

The general forms of the two shift operators are

x >> y