Array in c programming || Part:- 04 Designated initializer in array || #coding_halt Presents

preview_player
Показать описание
In C90 standard we have to initialize the arrays in the fixed order, like initialize index at position 0, 1, 2 and so on. From C99 standard, they have introduced designated initializing feature in C. Here we can initialize elements in random order. Initialization can be done using the array index or structure members. This extension is not implemented in GNU C++.

If we specify some index and put some value, then it will be look like this -

int arr[6] = {[3] = 20, [5] = 40}; or
int arr[6] = {[3]20, [5]40};
This is equivalent to this:

int arr[6] = {0, 0, 0, 20, 0, 40};
We can also put some range of elements using this syntax: [first … last] = value.

int arr[6] = {[2 … 4] = 10};
This is equivalent to this:

int arr[6] = {0, 0, 10, 10, 10, 0};
if the size of the array is not defined, then it can get the size from the maximum index position. Let us see the code to get better idea.

Watch the full video to know more
I hope you like our effort,please comment your views regarding it ,we will be thankful to you .

If you want to learn c programming for begenning you must cheek out our playlist link given below.

.....................................................................................................
****************************************************************************************
subscribe our channel and press the bell icon for amazing videos and coding updates......
keep coding keep supporting ......💥💥❤❤🎉🎉💖💖
like share and subscribe the video
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
______________________________________________________________
also check out these amazing videos
*****************************************

******************************************

Wired mic used by me:
Boya BYM1 Omnidirectional Lavalier Condenser Microphone with 20ft Audio Cable (Black)

********************************************
------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------

love from coding halt
Рекомендации по теме
welcome to shbcf.ru