Which of the following correctly represents a long double constant?
A:
6.68
B:
6.68L
C:
6.68f
D:
6.68LF
Answer:B
6.68 is double. 6.68L is long double constant. 6.68f is float constant. 6.68LF is not allowed in c.
Discuss About this Question.
Which of the following operations are INCORRECT?
A:
int i = 35; i = i%5;
B:
short int j = 255; j = j;
C:
long int k = 365L; k = k;
D:
float a = 3.14; a = a%3;
Answer:D
float a = 3.14; a = a%3; gives "Illegal use of floating point" error.
The modulus (%) operator can only be used on integer types. We have to use fmod() function in math.h for float values.
Discuss About this Question.
Which of the declaration is correct?
A:
int length;
B:
char int;
C:
int long;
D:
float double;
Answer:A
int length; denotes that variable length is int(integer) data type.
char int; here int is a keyword cannot be used a variable name.
int long; here long is a keyword cannot be used a variable name.
float double; here double is a keyword cannot be used a variable name.
So, the answer is int length;(Option A).
Discuss About this Question.
Point out the error in the following program.
#include<stdio.h>
int main()
{
int (*p)() = fun;
(*p)();
return 0;
}
int fun()
{
printf("ExamAdept.com\n");
return 0;
}
A:
Error: in int(*p)() = fun;
B:
Error: fun() prototype not defined
C:
No error
D:
None of these
Answer:B
The compiler will not know that the function int fun() exists. So we have to define the function prototype of int fun();
To overcome this error, see the below program
#include<stdio.h>int fun(); /* function prototype */int main()
{
int (*p)() = fun;
(*p)();
return0;
}
int fun()
{
printf("ExamAdept.com\n");
return0;
}
Discuss About this Question.
Which of the following is correct about err used in the declaration given below?
Discuss About this Question.