/* Example for ceil() and floor() functions: */
#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
Declaration never reserves any space for the variable or instance in the program's memory; it simply a "hint" to the compiler that a use of the variable or instance is expected in the program. This hinting is technically called "forward reference".
Example:
#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
#include<stdio.h> int main() { extern int a; printf("%d\n", a); return 0; } int a=20;
- During definition the value is initialized.
While a function definition specifies what a function does, a function prototype can be thought of as specifying its interface.
1 : | extern int fun(); |
2 : | int fun(); |
int fun(); declaration in C is to indicate the existence of a function inside the current module or in the same file.
1 : | extern int x; |
2 : | float square ( float x ) { ... } |
3 : | double pow(double, double); |
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.
Examples of valid (but not very descriptive) C variable names:
=> foo
=> Bar
=> BAZ
=> foo_bar
=> _foo42
=> _
=> QuUx
Comments
Copyright ©CuriousTab. All rights reserved.
pharmacy drugstore onlinepharmacy evaluating exam canada