C Preprocessor এর ব্যবহার ও উপযোগিতা

Submitted by tushar pramanick on Mon, 01/02/2012 - 16:42

In Chapter 2, "Writing Your First C Program," you learned how to use the #include preprocessor directive to include C header files. Since then, the #include directive has been used in every program in this book. In this lesson you'll learn more about the C preprocessor and making macro definitions with the preprocessor directives. The following topics are discussed in this hour:

    What the C preprocessor can do
    Macro definitions and macro substitutions
    The #define and #undef directives
    How to define function-like macros with #define
    The #ifdef, #ifndef, and #endif directives
    The #if, #elif, and #else directives
    How to nest #if and #elif directives




Summary
 

  •     The C preprocessor runs before the compiler. During preprocessing, all occurrences of a macro name are replaced by the macro body associated with the macro name.
  •     The C preprocessor also enables you to include additional source files to the program or compile sections of C code conditionally.
  •     The C preprocessor is not part of the C compiler.
  •     A macro statement ends with a newline character, not a semicolon.
  •     The #define directive tells the preprocessor to replace every occurrence of a macro name defined by the directive with a macro body that is associated with the macro name.
  •     The #undef directive is used to remove the definition of a macro name that has been previously defined.
  •     You can specify one or more arguments to a macro name defined by the #define directive.
  •     The #ifdef directive enables you to define code that is to be included when a particular macro name is defined.
  •     The #ifndef directive is a mirror directive to the #ifdef directive. The former enables you to define code that is to be included when a particular macro name is not defined.
  •     The #endif is used to mark the end of an #ifdef, an #ifndef, or an #if block.
  •     The #if, #elif, and #else directives enable you to select portions of code to compile.

 

Related Items

C প্রোগ্রাম এর ডেটা টাইপ এবং নামকরণ করার পদ্ধতি

ক্লাস 4: C ল্যাঙ্গুয়েজ এর ডেটা টাইপ এবং নেম

CLASS 4: Data Types and Names in C

C প্রোগ্রাম এর প্রয়োজনীয় উপকরন

C Programs এর প্রয়োজনীয় উপকরন

এই অধ্যায়ে আমরা শিখবো সি প্রোগ্রামিং এর জন্য কিছু প্রয়োজনীয় জিনিস । যেমন

সহজ সরল প্রথম C প্রোগ্রাম টি লিখতে শিখুন

আমরা জানি C একটি উচ্চ-স্তরের প্রোগ্রামিং ভাষা এবং C প্রোগ্রামগুলি বাইনারি কোডে অনুবাদ করতে C কম্পাইলার (Compiler) দরকার হয় । বাইনারি কোড কম্পিউটার বুঝতে পারে এবং এক্সিকিউট করতে পারে। C প্রোগ্রাম লিখতে যে বেসিক জিনিসগুলি জানতে হবে

C প্রোগ্রামিং কিভাবে শুরু করবে ?

C একটি প্রোগ্রামিং ল্যাঙ্গুয়েজ । C ল্যাঙ্গুয়েজ প্রথম তৈরি করেন ডেনিস রিচি (Dennis Ritchie) 1972 সালে AT&T Bell ল্যাবে । ডেনিস রিচি এর নাম দেন ল্যাঙ্গুয়েজ C । কারন এর আগে B বলে আগে থেকেই আর একটি প্ররগ্রামিং ল্যাঙ্গুয়েজ ছিল।

C programming in Bengali

C প্রোগ্রামিং ল্যাঙ্গুয়েজ শেখার জন্য আগে থেকে কোনও প্রোগ্রামিং ল্যাঙ্গুয়েজ জানার প্রয়োজন নেই, যদিও কম্পিউটারের সম্পর্কে কিছু জ্ঞান থাকার দরকার । C একটি শক্তিশালী সাধারণ উদ্দেশ্যে ব্যাবহৃত প্রোগ্রামিং ল্যাঙ্গুয়েজ। C প্রোগ্রামিং ল্যাঙ্গুয়েজ দিয়ে অপারেটিং সিস্টেম, ডাটাবেস, ..