IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C++ Programming C# Programming Java Programming
Microbiology Biochemistry Biotechnology Biochemical Engineering
Civil Engineering Mechanical Engineering Chemical Engineering Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C Programming - C Preprocessor - Discussion

@ : Home > C Programming > C Preprocessor > Point Out Errors - Discussion

2. 

Point out the error in the program

#include<stdio.h>

int main()
{
    int i;
    #if A
        printf("Enter any number:");
        scanf("%d", &i);
    #elif B
        printf("The number is odd");
    return 0;
}

[A]. Error: unexpected end of file because there is no matching #endif
[B]. The number is odd
[C]. Garbage values
[D]. None of above

Answer: Option C

Explanation:

The conditional macro #if must have an #endif. In this program there is no #endif statement written.


Meena said: (Sat, Sep 17, 2011 07:58:03 PM)    
 
Can we include the prreprocessors inside the program?

Preeti said: (Wed, Dec 19, 2012 09:29:42 AM)    
 
Yes I think. Because the above program gives output without errors when elif is replaced by endif.

Huma said: (Sat, Mar 16, 2013 11:47:17 AM)    
 
Yes we can define macros within main().

Write your comments here:
Name *:     Email:


© 2008-2013 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Contact us: info@indiabix.com     Follow us on twitter!