Önceki derslerde tek boyutlu dizileri görmüştük. Şimdi çok boyutlu dizileri göreceğiz. Örneğin çift boyutlu bir dizi oluşturalım. int dizi[3][3]={1,2,3,4,5,6,7,8,9}; Yukarıda oluşturduğumuz aslında 3×3 lük bir matristir ve görüntüsü aşağıdaki gibidir. Şimdi dizinin elemanlarını yazdıralım. printf(“%d\t%d\t%d\t%d”,dizi[0][0],dizi[0][1],dizi[2][0],dizi[2][2]); Faydalı Yetersiz
Articles Tagged: c library
time
2.15.10 time Declaration: time_t time(time_t *timer); Calculates the current calender time and encodes it into time_t format. The time_t value is returned. If timer is not a null pointer, then the value is also stored into the object it points to. If the time is unavailable, then -1 is returned. Faydalı Yetersiz
strftime
2.15.9 strftime Declaration: size_t strftime(char *str, size_t maxsize, const char *format, const struct tm *timeptr); Formats the time represented in the structure timeptr according to the formatting rules defined in format and stored into str. No more than maxsizecharacters are stored into str (including the terminating null character). All characters in the format string are copied to the str string, including the terminating null character, except for conversion […]
localtime
2.15.7 localtime Declaration: struct tm *localtime(const time_t *timer); The value of timer is broken up into the structure tm and expressed in the local time zone. A pointer to the structure is returned. Example: #include<time.h> #include<stdio.h> int main(void) { time_t timer; timer=time(NULL); printf(“The current time is %s.\n”,asctime(localtime(&timer))); return 0; } Faydalı Yetersiz
gmtime
2.15.6 gmtime Declaration: struct tm *gmtime(const time_t *timer); The value of timer is broken up into the structure tm and expressed in Coordinated Universal Time (UTC) also known as Greenwich Mean Time (GMT). A pointer to the structure is returned. A null pointer is returned if UTC is not available. Faydalı Yetersiz
difftime
2.15.5 difftime Declaration: double difftime(time_t time1, time_t time2); Calculates the difference of seconds between time1 and time2 (time1-time2). Returns the number of seconds. Faydalı Yetersiz
ctime
2.15.4 ctime Declaration: char *ctime(const time_t *timer); Returns a string representing the localtime based on the argument timer. This is equivalent to: asctime(locatime(timer)); The returned string is in the following format: DDD MMM dd hh:mm:ss YYYY DDD Day of the week (Sun, Mon, Tue, Wed, Thu, Fri, Sat) MMM Month of the year (Jan, Feb, Mar, […]
clock
2.15.3 clock Declaration: clock_t clock(void); Returns the processor clock time used since the beginning of an implementation-defined era (normally the beginning of the program). The returned value divided by CLOCKS_PER_SEC results in the number of seconds. If the value is unavailable, then -1 is returned. Example: #include<time.h> #include<stdio.h> int main(void) { clock_t ticks1, ticks2; ticks1=clock(); ticks2=ticks1; while((ticks2/CLOCKS_PER_SEC-ticks1/CLOCKS_PER_SEC)<1) […]
asctime
2.15.2 asctime Declaration: char *asctime(const struct tm *timeptr); Returns a pointer to a string which represents the day and time of the structure timeptr. The string is in the following format: DDD MMM dd hh:mm:ss YYYY DDD Day of the week (Sun, Mon, Tue, Wed, Thu, Fri, Sat) MMM Month of the year (Jan, Feb, Mar, […]
Değişkenler ve Tanımlar
2.15.1 Variables and Definitions NULL is the value of a null pointer constant. CLOCKS_PER_SEC is the number of processor clocks per second. size_t is the unsigned integer result of the sizeof keyword. clock_t is a type suitable for storing the processor time. time_t is a type suitable for storing the calendar time. struct tm is a structure used to hold the […]