Lesson 19 of 23

Call by Reference: Swap

9 min 35 XP

Variable-ന്റെ address അയച്ചാൽ function-ന് ആ variable തന്നെ മാറ്റാം. scanf(&x) കൃത്യമായി ഇങ്ങനെയാണ് പ്രവർത്തിക്കുന്നത്, ഒരു function ഒന്നിലധികം values തിരികെ നൽകുന്നതും ഇങ്ങനെ തന്നെ.

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

Function-ലേക്ക് array അയയ്ക്കുമ്പോൾ അതിന്റെ ആദ്യ ഘടകത്തിന്റെ address ആണ് പോകുന്നത്, അതിനാൽ function-ൽ വരുത്തിയ മാറ്റങ്ങൾ main-ലും കാണാം.

Challenge

+35 XP

ഹരണഫലം q-ലും ശിഷ്ടം r-ലും സൂക്ഷിക്കുന്ന void divide(int a, int b, int *q, int *r) എഴുതൂ. main()-ൽ a, b വായിച്ച് print ചെയ്യൂ: Input: 17 5 Output: Quotient 3, Remainder 2

Output Loading C (first time takes a few seconds)
Press Run to see the result here.