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

Using Unions

Using Unions

Now let's focus on the applications of unions. Basically, there are two kinds of union applications, which are introduced in the following two sections.
Referencing the Same Memory Location Differently

Unions Versus Structures

Unions Versus Structures

What Is a Union?

What Is a Union?

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.

Question and Answer

Question and Answer

    Q What are the left and right values?