Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Guess the OUTPUT | C Programming Tutorial | Tricky Question and Answer
Play lesson

Learn C Programming Language | Tutorial for Beginners - Guess the OUTPUT | C Programming Tutorial | Tricky Question and Answer

5.0 (1)
31 learners

What you'll learn

This course includes

  • 25.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Here in this guess the output c programming language video tutorial for beginners we give you a c aptitude tricky question program which will be normally asked in interviews and you have to find the output of the program. In the end we explain the output. When we build and run this program and we get the error at line number 6 and if I open up the error logs it says error At The Line Number 6 Invalid pre processor directive #check and then in the line number 8 it says error endif pre processor directive without a if pre processor directive. now let’s see why we get this error. In this program we have defined a macro called as check with the value of if and then we have defined another macro X with a value of 100. And in this main function which we have used this check Macro here and then we are checking whether this X macro is containing a value of 100. If it is so that we are including this line for the compilation process and then you know we have this printf function. so here we are expecting this CHECK macro to expand to if and we are expecting it to work like #if here. But in C programming the # and the preprocessor directive name cannot come from a macro expansion. There are rules to use the preprocessor directives. So first we need to use the symbol hash and then we need to write the pre processor directive name and then according to that pre processor directive name we will be writing the other values. since this #CHECK is not a valid pre processor directive it generate the error. This is about the first error and then we have another error and that is the endif preprocessor directive without the if pre processor directive. Since this will not expand to #if, if we use this endif then it will be without a if pre processor directive. so it generates that 2nd error. SO one thing to remember is in C programming if you are using the preprocessor directives then the # and the preprocessor directive name cannot come from a macro expansion. Watch the entire series at https://www.youtube.com/watch?v=y9T4a7W1Pe0&list=PLfVsf4Bjg79CQQBFnpbqMcHg63FyhciHZ Get the source code of this tutorial at our website http://www.LearningLad.com Watch Video tutorials in HINDI at http://www.youtube.com/user/LearningLadHindi Catch us on Social Media Facebook http://www.facebook.com/LearningLad Twitter http://www.twitter.com/LearningLadEdu Google+ http://www.google.com/+LearningLad

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere