Lesson 20 of 23

Pointers மற்றும் ArraysPointers and Arrays

10 min 35 XP

Array பெயர் அதன் முதல் உறுப்பின் address. ஆகவே a[i] என்பது *(a + i). p++ அடுத்த உறுப்புக்குச் செல்லும் (int-க்கு 4 bytes முன்னே).

An array's name is the address of its first element, so a[i] is the same as *(a + i). p++ moves to the next element (4 bytes ahead for an int).

Example: edit me and press Run

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

Challenge

+35 XP

n மற்றும் n எண்களைப் படித்து, pointers மட்டும் பயன்படுத்தி (a[i] கூடாது; *(a + i) அல்லது p++) array-ஐ in-place reverse செய்து print செய்யுங்கள். Input: 5 1 2 3 4 5 Output: 5 4 3 2 1

Read n and n numbers. Reverse the array in place using only pointers (no a[i]; use *(a + i) or p++), then print it. Input: 5 1 2 3 4 5 Output: 5 4 3 2 1

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