Lesson 18 of 23

Pointers: Addresses ഉപയോഗിച്ചുള്ള പ്രവർത്തനം

12 min 35 XP

ഓരോ variable-ഉം memory-യിൽ ഒരു address-ൽ ആണ്; &x ആ address നൽകുന്നു. Pointer എന്നത് address സൂക്ഷിക്കുന്ന variable ആണ്: int *p = &x;. *p ആ address-ലെ value വായിക്കുകയോ എഴുതുകയോ ചെയ്യുന്നു (dereferencing).

Example: edit me and press Run

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

NULL pointer dereference ചെയ്താൽ പ്രോഗ്രാം crash ആകും (segmentation fault). Pointer ഉപയോഗിക്കുന്നതിന് മുമ്പ് NULL പരിശോധിക്കൂ.

Challenge

+35 XP

രണ്ട് സംഖ്യകൾ വായിക്കൂ. Pointers int *pa = &a, *pb = &b ഉപയോഗിച്ച് *pa, *pb വഴി തുക കണക്കാക്കി, *pa വഴി അത് വീണ്ടും a-യിൽ സൂക്ഷിച്ച് print ചെയ്യൂ: Input: 4 9 Output: Sum: 13 a: 13

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