Lesson 11 of 23

ArraysArrays

9 min 25 XP

Array ஒரே type-ன் பல மதிப்புகளை அடுத்தடுத்த memory இடங்களில் சேமிக்கும். Index 0-லிருந்து தொடங்கும். C, array எல்லையைச் சோதிக்காது; a[10] என்ற 5 அளவு array-ல் எழுதினால் memory பாழாகும், கவனம்!

An array stores values of one type in consecutive memory. Indexes start at 0. C does not check bounds: writing a[10] in a 5-element array corrupts memory, so be careful!

Example: edit me and press Run

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

Example: edit me and press Run

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

sizeof(arr) / sizeof(arr[0]) array-ன் உறுப்புகளின் எண்ணிக்கையைத் தரும் (array அதே function-ல் உருவாக்கப்பட்டிருந்தால் மட்டும்).

sizeof(arr) / sizeof(arr[0]) gives the number of elements, but only in the function where the array was declared.

Challenge

+25 XP

n மற்றும் n எண்களைப் படித்து, அவற்றில் இரண்டாவது பெரிய எண்ணை print செய்யுங்கள் (எல்லா எண்களும் வேறுபட்டவை). Input: 5 3 8 1 9 4 Output: 8

Read n and n distinct numbers, then print the second largest. Input: 5 3 8 1 9 4 Output: 8

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