Breaking

मंगलवार, 14 अप्रैल 2020

BCA 2nd Sem Notes-Conditional compilation

  • UNIT-I (Array)
Definition
Declaration & initialization of 1D 
Accessing array elements
Displaying array elements
Sorting arrays
Arrays and function
Declaration & initialization of 1D
Accessing and Displaying
Memory representation of array [Row Major, Column Major]
Multidimensional array






  • UNIT-II (Pointers)
  • Definition
    Declaration & initialization
    Indirection operator
    address of operator
    pointer arithmetic
    dynamic memory allocation
    arrays and pointers
    function and pointers






  • UNIT-III (Strings)

  • strlen(),strcpy(),   strcat() ,strcmp()






  • UNIT-IV (Structures)
  • Definition






  • UNIT-V                                       (C Preprocessor)


  • UNIT-VI                                     (File Handling)

  • Conditional compilation


    Conditional Compilation orders help to assemble a particular bit of the program or let us skip assemblage of some particular piece of the program dependent on certain conditions. In our past article, we have examined two such orders 'ifdef' and 'endif'. Right now will talk about #ifndef, #if, #else and #elif


    Six directives are available to control conditional compilation
    • #if
    • #ifdef
    • #ifndef
    • #else
    • #elif
    The #if a directive 


     syntax:
    #if constant-expression newline
    
    This directive checks whether the constant-expression is true (nonzero). The operand must be a constant integer expression that does not contain any increment (++), decrement (- -), sizeof , pointer (*), address (&), and cast operators.

    The #ifdef Directive

     syntax:
    #ifdef identifier newline
    
    This directive checks whether the identifier is currently defined. Identifiers can be defined by a #define directive or on the command line. If such identifiers have not been subsequently undefined, they are considered currently defined.

    The #ifndef Directive

     syntax:
    #ifndef identifier newline
    
    This directive checks to see if the identifier is not currently defined.

    The #else Directive

    syntax:
    #else newline
    
    This directive delimits alternative source text to be compiled if the condition tested for in the corresponding #if , #ifdef , or #ifndef a directive is false. An #else a directive is optional.

    The #elif Directive

     syntax:
    #elif constant-expression newline
    
    The #elif directive performs a task similar to the combined use of the else-if statements in C. This directive delimits alternative source lines to be compiled if the constant expression in the corresponding #if , #ifdef , #ifndef , or another #elif a directive is false and if the additional constant expression presented in the #elif the line is true. An #elif a directive is an option



    The #endif Directive


     syntax:
    #endif newline
    
    This directive ends the scope of the #if , #ifdef , #ifndef , #else , or #elif directive.
    The number of necessary #endif directives changes according to whether the elif or #else a directive is used. Consider the following equivalent examples:
    #if true                             #if true
    .                                    .
    .                                    .
    .                                    .
    #elif true                           .
    .                                    #else
    .                                    #if false
    .                                    .
    #endif                               .
                                         .
                                         #endif
                                         #endif
    
    
    
    


    कोई टिप्पणी नहीं:

    एक टिप्पणी भेजें