Which of the following has the compilation error in C?

 

Which of the following has the compilation error in C?

  1. int n = 17;
  2. char c = 99;
  3. float f = (float)99.32;
  4. #include <stdio.h>
4Comments
Pavan Singh @pavansingh
17 Apr 2017 03:13 am

3

shivani @shivani1234
17 Apr 2017 12:32 pm

In my opinion , answer here should be none of these , the reason being none gives compiler error

  1. int n = 17;//since it is assigning integer value to a variable of type integer
  2. char c = 99;//here 99 is considered as ASCII value what ever character is associated to it is assigned to char c
  3. float f = (float)99.32;// it is just typecasting
  4. #include <stdio.h> //it is just preprocessor directive 
    You can see screenshot here
shweta @shweta1920
17 Apr 2017 01:17 pm

in screenshot .. what is written in cmd prompt is not clear ...

Virtual GATE @virtualgate
17 Apr 2017 01:47 pm

@shweta1920, you can try running this codes on your machine too, by downloading the standard c-compiler

see http://www.mingw.org/ : for windows 

and any linux distribution has c-compiler (GCC) by default .

How to run programs using GCC ?

see: http://pages.cs.wisc.edu/~beechung/ref/gcc-intro.html

and http://www.akira.ruc.dk/~keld/teaching/CAN_e14/Readings/How%20to%20Compi...

 

Pages