Sams Teach Yourself C in 21 Days
be more used to. Remember, one radian equals 57.296 degrees, and a full circle (360 degrees) contains 2πradians. Trigonometric F ...
Exploring the C Function Library 535 19 log10() double log10(double x) Returns the base-10 logarithm of its argu- ment. The argu ...
abs() int abs(int x) Return the absolute labs()long labs(long x) value of their arguments. floor() double floor(double x) Return ...
Exploring the C Function Library 537 19 16: printf(“\nCeil: %lf”, ceil(x)); 17: printf(“\nFloor: %lf”, floor(x)); 18: if( x > ...
struct tm { int tm_sec; // seconds after the minute - [0,59] int tm_min; // minutes after the hour - [0,59] int tm_hour; // hour ...
Exploring the C Function Library 539 19 This function returns a pointer to a static type tmstructure, so you don’t need to decla ...
TABLE19.1 Conversion specifiers that can be used with strftime() Specifier What It’s Replaced By %a Abbreviated weekday name. %A ...
Exploring the C Function Library 541 19 %z The locale’s time zone or abbreviation. If the time zone isn’t known, then this would ...
13: /* Record the time the program starts execution. */ 14: 15: start = time(0); 16: 17: /* Record the current time, using the a ...
Exploring the C Function Library 543 19 Sun May 19 13:28:53 2002 This is week 20 of the year 2002 Today is Sunday, 05/19/02 It i ...
Theassert()Macro .................................................................................... The macro assert()can diag ...
Exploring the C Function Library 545 19 8: int x; 9: 10: printf(“\nEnter an integer value: “); 11: scanf(“%d”, &x); 12: 13: ...
to Listing 19.3, on line 2. Now the program prints the value entered and then terminates normally, even if you enter -1. Note th ...
Exploring the C Function Library 547 19 indication that an error occurred, you can test errno. If it’s nonzero, an error has occ ...
18: printf(“errno = %d.\n”, errno); 19: exit(1); 20: } 21: else 22: { 23: puts(“File opened for reading.”); 24: fclose(fp); 25: ...
Exploring the C Function Library 549 19 Searching with bsearch()................................................................ ...
The binary search algorithm is very efficient; it can search a large array quickly. Its oper- ation is dependent on the array el ...
Exploring the C Function Library 551 19 LISTING19.5 sort.c. Using the qsort()andbsearch()functions with values 1: /* Using qsort ...
49: return 0; 50: } 51: 52: int intcmp(const void *v1, const void *v2) 53: { 54: return (*(int *)v1 - *(int *)v2); 55: } Enter 2 ...
Exploring the C Function Library 553 19 arr[17] = 1999. arr[18] = 2300. arr[19] = 9999. Press Enter to continue. Enter a value t ...
«
24
25
26
27
28
29
30
31
32
33
»
Free download pdf