Lesson 18 of 23

Pointers: Address-களுடன் வேலை

12 min 35 XP

ஒவ்வொரு variable-ம் memory-ல் ஒரு address-ல் இருக்கும். &x அந்த address-ஐத் தரும். Pointer என்பது address-ஐ சேமிக்கும் variable: int *p = &x;. *p அந்த address-ல் உள்ள மதிப்பு (dereference).

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 செய்தால் (*q) program crash ஆகும் (segmentation fault). பயன்படுத்தும் முன் NULL-ஆ என்று சோதியுங்கள்.

Challenge

+35 XP

இரண்டு எண்களைப் படித்து, pointers மட்டும் பயன்படுத்தி (int *pa = &a, *pb = &b) அவற்றின் கூட்டுத்தொகையைக் கணக்கிட்டு, a-ல் அந்தக் கூட்டுத்தொகையை *pa மூலம் சேமித்து 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.