8.6: USING ESCAPE SEQUENCE IN PRINTF()

8.6: প্ৰিণ্টএফত এস্কেপ ক্ৰম ব্যৱহাৰ কৰা()

Our first C program (Example 8.1) displayed a sentence on the monitor using the function printf(). In this section, we will learn using escape sequences inside printf() to display sentences differently (e.g. printing sentences in different lines, putting gaps in the display, etc.). An escape sequence in a programming language is a sequence of characters that does not represent itself when used inside a character or string literal, but is translated into another character or a sequence of char acters that may be difficult or impossible to represent directly.

আমাৰ প্ৰথম চি প্ৰ’গ্ৰাম (উদাহৰণ 8.1) ফাংচন প্ৰিণ্টফ() ব্যৱহাৰ কৰি মনিটৰত এটা বাক্য প্ৰদৰ্শন কৰিছিল। এই শাখাত, আমি বাক্যবোৰ পৃথকভাৱে প্ৰদৰ্শন কৰিবলৈ প্ৰিণ্টফ() ভিতৰত এস্কেপ ক্ৰম ব্যৱহাৰ কৰি শিকিম (যেনে বিভিন্ন শাৰীত বাক্য প্ৰিণ্ট কৰা, ডিচপ্লেত ব্যৱধান ৰখা ইত্যাদি)। প্ৰ’গ্ৰামিং ভাষাএটাত এস্কেপ ক্ৰম হৈছে চৰিত্ৰৰ এটা ক্ৰম যি চৰিত্ৰ বা স্ট্ৰিং আক্ষৰিক ভাৱে ব্যৱহাৰ কৰিলে নিজকে প্ৰতিনিধিত্ব নকৰে, কিন্তু আন এটা চৰিত্ৰ বা চাৰ এক্টাৰৰ ক্ৰমলৈ অনুবাদ কৰা হয় যাক পোনপটীয়াকৈ প্ৰতিনিধিত্ব কৰা কঠিন বা অসম্ভৱ হ’ব পাৰে।

In C, all escape sequences consist of two or more characters, the first of which is the backslash, (called the “Escape character”). The remaining characters determine the interpretation of the escape sequence.

চি-ত, সকলো এস্কেপ ক্ৰমত দুটা বা ততোধিক বৰ্ণ থাকে, যাৰ প্ৰথমটো হৈছে বেকশ্লেছ, (যাক “এস্কেপ চৰিত্ৰ” বুলি কোৱা হয়)। বাকী থকা চৰিত্ৰবোৰে পলায়নক্ৰমৰ ব্যাখ্যা নিৰ্ধাৰণ কৰে।

We may use these escape sequence characters in the printf() function of the program we discussed before. For example, if we want to print in two lines, we may use \n. Example 8.2 demonstrates one such program.

আমি আগতে আলোচনা কৰা প্ৰ’গ্ৰামৰ প্ৰিণ্টফ() ফাংচনত এই এস্কেপ ক্ৰম বৰ্ণবোৰ ব্যৱহাৰ কৰিব পাৰোঁ। উদাহৰণ স্বৰূপে, যদি আমি দুটা শাৰীত প্ৰিণ্ট কৰিব বিচাৰো, আমি ব্যৱহাৰ কৰিব পাৰোঁ। উদাহৰণ স্বৰূপে 8.2-এ এনে এটা প্ৰ’গ্ৰাম প্ৰদৰ্শন কৰে।