Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : clock

clock_tclock(void param1) ;

Return Type : clock_t

Integer type for CPU time measurements
Read about return values of clock function .

1st Parameter Type : void

Type that indicates no return value

1st Parameter

Indicates that the function takes no arguments

Read more about parameters of clock in parameters section
The clockfunction in C language Returns the processor time consumed by the program.
The clock function returns an approximation of processor time used by the program. The value returned is the CPU time used so far as a clock_t; to get the number of seconds used, you'll need to divide by CLOCKS_PER_SEC. Note that if the processor time used is not available or its value cannot be represented, the function returns the value (clock_t)-1.
The clockfunction takes 1 parameter:
  • void ``: Indicates that the function takes no arguments
Returns the processor time consumed by the program since it started execution, measured in clock ticks. The value can be divided by `CLOCKS_PER_SEC` to obtain the time in seconds. Returns `-1` if the processor time is not available.
The clock function return value :
  • Returns the processor time used by the program since the beginning of an implementation-defined era related to the program invocation
  • To convert this into seconds, divide by CLOCKS_PER_SEC
  • If the processor time used is not available or its value cannot be represented, the function returns (clock_t)-1

Output

This example demonstrates the basic usage of the `clock` function to measure the CPU time used by a simple loop. It calculates the difference between the start and end times and converts it to seconds.