मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता १२

Why strlen is called pure function? - Computer Science

Advertisements
Advertisements

प्रश्न

Why strlen is called pure function?

टीपा लिहा

उत्तर

strlen (s) is called each time and strlen needs to iterate over the whole of ‘s’. If the compiler is smart enough to work out that strlen is a pure function and that ‘s’ is not updated in the lbop, then it can remove the redundant extra calls to strlen and make the loop execute only one time. This function reads external memory but does not change it, and the value returned derives from the external memory accessed.

shaalaa.com
Pure Functions
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 1: Function - Evaluation [पृष्ठ ९]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 12 TN Board
पाठ 1 Function
Evaluation | Q 2. | पृष्ठ ९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×