MCQs
In computing, 'real number' often refers to non-complex floating-point numbers.It
include both rational numbers, such as 42 and 3/4, and irrational numbers such
as pi = 3.14159265...
When the accuracy of the floating point number is insufficient, we can use the doubleto
define the number. The double is same as float but with longer precision and takes double
space (8 bytes) than float.
To extend the precision further we can use long double which occupies 10 bytes of memory
space.
#include<stdio.h>
#include<math.h>
int main()
{
printf("\n Result : %f" , ceil(1.44) );
printf("\n Result : %f" , ceil(1.66) );
printf("\n Result : %f" , floor(1.44) );
printf("\n Result : %f" , floor(1.66) );
return 0;
}
// Output:
// Result : 2.000000
// Result : 2.000000
// Result : 1.000000
// Result : 1.000000
Variable names in C are made up of letters (upper and lower case) and digits. The underscore character ("_") is also permitted. Names must not begin with a digit.
Examples of valid (but not very descriptive) C variable names:
=> foo
=> Bar
=> BAZ
=> foo_bar
=> _foo42
=> _
=> QuUx
External Linkage-> means global, non-static variables and functions.
Internal Linkage-> means static variables and functions with file scope.
None Linkage-> means Local variables.
extern int fun(); declaration in C is to indicate the existence of a global function
and it is defined externally to the current module or in another file.
int fun(); declaration in C is to indicate the existence of a function inside the
current module or in the same file.
fmod (x, y) - Calculates x modulo y, the remainder of x/y.
This function is the same as the modulus operator. But fmod() performs floating point
divisions.
#include <stdio.h>
#include <math.h>
int main ()
{
printf ("fmod of 3.14/2.1 is %lf\n", fmod (3.14,2.1) );
return 0;
}
Output:
fmod of 3.14/2.1 is 1.040000
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)();
return 0;
}
int fun()
{
printf("placementadda");
return 0;
}
By default data type of numeric constants is:
6.5 : double
90000: long int
‘A’: char
double is 8 byte
long int is 8 byte
Character constant is 2 byte
Linker Error : Undefined symbol 'i'
The statement extern int i
specifies to the compiler that the memory for 'i'
is allocated in some other program and that address will be given to the
current program at the time of linking. But linker finds that no other
variable of name 'i' is available in any other program with memory space allocated for it. Hence a linker error has occurred.
In computing, 'real number' often refers to non-complex floating-point
numbers. It include both rational numbers, such as 42 and 3/4, and
irrational numbers such as pi = 3.14159265...
When the accuracy of the floating point number is insufficient, we can use the double to define the number. The double is same as float but with longer precision and takes double space (8 bytes) than float.
To extend the precision further we can use long double which occupies 10 bytes of memory space.