9.2 VARIABLE, DAA TYPES AND FORMAT SPECIFIERS

9.2 ভেৰিয়েবল, ডাএএ প্ৰকাৰ আৰু ফৰ্মেট স্পেচিফায়াৰ

A variable is an identifier that is used to some value within a program. The value stored in a variable can change during the program. A variable must be declared first before it is used in the program.

চলক হৈছে এক চিনাক্তকৰ্তা যাক প্ৰ’গ্ৰাম এটাৰ ভিতৰত কিছু মানৰ বাবে ব্যৱহাৰ কৰা হয়। চলক এটাত সঞ্চিত মূল্য প্ৰ’গ্ৰামৰ সময়ত সলনি হ’ব পাৰে। প্ৰ’গ্ৰামত ব্যৱহাৰ কৰাৰ আগতে চলক এটা প্ৰথমে ঘোষণা কৰিব লাগিব।

Every variable is associated with a type from the declaration itself. This is called the data type of a variable is statement in C to declare a variable ‘X’ of type integer with an initial value of 7.

প্ৰতিটো চলক ঘোষণাৰ পৰাই এটা প্ৰকাৰৰ সৈতে সম্পৰ্কিত। ইয়াক চলকৰ ডাটা প্ৰকাৰ বুলি কোৱা হয়, 7 ৰ প্ৰাৰম্ভিক মূল্যৰ সৈতে প্ৰকাৰ ইণ্টেগাৰৰ পৰিৱৰ্তনশীল ‘এক্স’ ঘোষণা কৰিবলৈ চি-ত বিবৃতি।

When we declare a variable in a program, a program a certain amount of memory space is allocated for the variable to store its store its value. Depending on the data type, the amount of memory space varies and thus the range of values the variable can store also varies.

যেতিয়া আমি প্ৰ’গ্ৰাম এটাত চলক এটা ঘোষণা কৰোঁ, এটা প্ৰ’গ্ৰাম ৰ মূল্য সংৰক্ষণ কৰিবলৈ চলকৰ বাবে এক নিৰ্দিষ্ট পৰিমাণৰ মেম’ৰী স্থান আৱণ্টন কৰা হয়। ডাটাৰ প্ৰকাৰৰ ওপৰত নিৰ্ভৰ কৰি, মেম’ৰী স্থানৰ পৰিমাণ পৃথক হয় আৰু এনেদৰে চলকে সংৰক্ষণ কৰিব পৰা মানৰ পৰিসৰও পৃথক হয়।

When we want to print the value of a variable, we need to specify this using the appropriate format specifier of its type. Same is the case for accepting the value of a variable from the keyboard. The following statement prints the value of variable x on the output screen.

যেতিয়া আমি চলক এটাৰ মূল্য প্ৰিণ্ট কৰিব বিচাৰো, আমি ইয়াৰ প্ৰকাৰৰ উপযুক্ত ফৰ্মেট স্পেচিফায়াৰ ব্যৱহাৰ কৰি ইয়াক নিৰ্দিষ্ট কৰিব লাগিব। কীবোৰ্ডৰ পৰা চলকএটাৰ মূল্য গ্ৰহণ কৰাৰ ক্ষেত্ৰতো একেই। নিম্নলিখিত বিবৃতিটোৱে আউটপুট স্ক্ৰীণত চলক এক্সৰ মূল্য প্ৰিণ্ট কৰে।

Table 9.3 lists some built-in datatypes in C with their typical storage requirements and format specifiers. In addition to these built-in data types, C supports derived data types like array, structure pointer, etc. we will study them in class X.

তালিকা 9.3-ত চি-ত কিছুমান বিল্ট-ইন ডাটাটাইপ তেওঁলোকৰ সাধাৰণ ষ্টোৰেজ প্ৰয়োজনীয়তা আৰু ফৰ্মেট স্পেচিফায়াৰৰ সৈতে তালিকাভুক্ত কৰা হৈছে। এই বিল্ট-ইন ডাটা প্ৰকাৰবোৰৰ উপৰিও, চি-য়ে প্ৰাপ্ত ডাটা প্ৰকাৰ যেনে এৰে, ষ্ট্ৰাকচাৰ পইণ্টাৰ আদি সমৰ্থন কৰে। আমি সেইবোৰ দশম শ্ৰেণীত অধ্যয়ন কৰিম।

Table 9.3: Built-in data types of C programming language.

We have already seen printing message and variables on the screen. Let us now see how we can accept input to the program from users. We may use another library function scanf()for this Scanf”() is one of the commonly used built – in functions to take input users.

আমি ইতিমধ্যে স্ক্ৰীণত বাৰ্তা আৰু চলক প্ৰিণ্ট কৰা দেখিছোঁ। এতিয়া আমি ব্যৱহাৰকাৰীসকলৰ পৰা প্ৰ’গ্ৰামটোত ইনপুট কেনেদৰে গ্ৰহণ কৰিব পাৰোঁ চাওঁ আহক। আমি এই স্কেনফৰ বাবে আন এটা লাইব্ৰেৰী ফাংচন স্কেনফ ()ব্যৱহাৰ কৰিব পাৰোঁ”() হৈছে সচৰাচৰ ব্যৱহৃত এক – ইনপুট ব্যৱহাৰকাৰী লোৱাৰ ফাংচনবোৰত।

The scanf() function reads form the standard input devices such as keyboards.

স্কেনফ() ফাংচনটোৱে মানক ইনপুট ডিভাইচ যেনে কীবোৰ্ড গঠন কৰে।

The following of code will of code will accept an integer value for the variable y:

কোডৰ কোড উইলৰ নিম্নলিখিতবোৰে চলক ৱাইৰ বাবে এটা ইণ্টেগাৰ মান গ্ৰহণ কৰিব:

The variable name is prefixed by a symbo1 ampersand (&). This indicated the address of the variable in computer memory: Scanf() function requires the address of the variable to0 read input in it. You may enter any valid integer value from the keybord.

পৰিৱৰ্তনশীল নামটো এটা চিম্বো1 এম্পাৰচেণ্ড (&)ৰ দ্বাৰা পূৰ্বনিৰ্ধাৰিত কৰা হৈছে। ই কম্পিউটাৰ মেম’ৰীত চলকৰ ঠিকনা সূচিত কৰিছে: স্কেনফ() ফাংচনৰ বাবে ইয়াত চলকৰ পৰা 0 পঢ়া ইনপুটৰ ঠিকনাৰ প্ৰয়োজন। আপুনি কীবৰ্ডৰ পৰা যিকোনো বৈধ ইণ্টেগাৰ মান প্ৰবিষ্ট কৰিব পাৰে।

Please remember the printf() statement is written just to inform the user for entering the integer value. This is not a mandatory statement here. You may Example 9.1 for the complete program.

অনুগ্ৰহ কৰি মনত ৰাখিব যে প্ৰিণ্টফ() বিবৃতিটো কেৱল ইণ্টেগাৰ মূল্য প্ৰবিষ্ট কৰাৰ বাবে ব্যৱহাৰকাৰীক অৱগত কৰিবলৈ লিখা হৈছে। এইটো ইয়াত এটা বাধ্যতামূলক বিবৃতি নহয়। সম্পূৰ্ণ প্ৰ’গ্ৰামৰ বাবে আপুনি উদাহৰণ 9.1 কৰিব পাৰে।