6,936 views
4 votes
4 votes

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>

4 Answers

Best answer
4 votes
4 votes
None of them not even giving any compiler warning even with strict C standard.
7 votes
7 votes
Yes ; all r seeming correct;

But a,b,c options are absolutely correct.

Now come to option D;;

Now Suppose User has installed TC & then he had move this into another location say D drive without intimating this change to TC. Then while compiling it will get err bcz it will search Library file STDIO.H in C:/TC/INCLUDE which is not available der due to users move operation;Hence it is one of the possibilities to Get Compiler Err.

Reference:http://www.infolet.org/2013/08/solving-unable-to-open-include-file-stdio.h-conio.h-iostream.h-c0s.obj.html?m=1
edited by
1 votes
1 votes

By looking at them i would like say there is no error.

Here ans is #include<stdio.h> which is not appropriate but compared to other .Now See

int n=17; //No error since int value

char c=99 ;// char even take int so no error

float=(float)99.32 //No error float is type-casting

#include<stdio.h>//If you have single statement"#include<stdio.h>" Compiler  Simply generate error Undefined reference to main()

1 votes
1 votes

By looking at them i would like say there is no error.

Here ans is #include<stdio.h> which is not appropriate but compared to other .Now See

int n=17; //No error since int value

char c=99 ;// char even take int so no error

float=(float)99.32 //No error float is type-casting

#include<stdio.h>//If you have single statement"#include<stdio.h>" Compiler  Simply generate error Undefined reference to main()

Source - https://gateoverflow.in/46861/which-following-compilation-error-float-float-%23include-studio

Answer:

Related questions

9 votes
9 votes
5 answers
1
go_editor asked Jun 21, 2016
6,120 views
The for loopfor (i=0; i<10; ++i) printf("%d", i&1);prints0101010101011111111100000000001111111111
10 votes
10 votes
4 answers
2
go_editor asked Jun 21, 2016
9,377 views
The output of the following program ismain() { static int x[] = {1,2,3,4,5,6,7,8} int i; for (i=2; i<6; ++i) x[x[i]]=x[i]; for (i=0; i<8; ++i) printf("%d", x[i]); }1 2 3 ...
8 votes
8 votes
2 answers
3
go_editor asked Jun 21, 2016
7,630 views
Consider the following program fragmenti=6720; j=4; while (i%j)==0 { i=i/j; j=j+1; }On termination j will have the value4896720
7 votes
7 votes
3 answers
4
go_editor asked Jun 21, 2016
6,607 views
The following programmain() { inc(); inc(); inc(); } inc() { static int x; printf("%d", ++x); }prints 012prints 123prints 3 consecutive, but unpredictable numbersprints 1...