Notes for You:: One Dimensional Arrays in C - C Programming Tutorial 69
- While accessing each element in an array; if it requires only one indexor subscriptsuch an array is called 1-dimensional array.
Example: arrayName[index]
Note:
- 1D array is used to store list of values arranged in either a row or a column
Declaring a one dimensional array in C:
Syntax:
data_typearrayName[size];
Example:
int numbers[5]; // numbers is an array; which can hold 5 integer values
Note:
- implicit pointers associated with one dimensional arrays in C.
- arrayName is implicitly a pointer to the first element in the array
- i.e. arrayName returns address of the first element in the array.
- &arrayName is implicitly a pointer to the whole array.
- i.e.&arrayName returns beginning address of the whole array
Getting a value of an array element:
- We can get a value of an array element by its index.
Syntax:
arrayName[index]
Example:
printf(“%d\n”,numbers[0]); // garbage integer value
Declaring and initializing a one dimensional array:
Syntax:
data_typearrayName[size] = {list of values separated by comma};
Example:
int numbers[5] = {0, 0, 0, 0, 0};
Setting new value to an array element:
- We can set a new value to an array element using assignment operator.
Syntax:
arrayName[index]=newvalue;
Example:
numbers[0]=10;
printf(“%d\n”,numbers[0]); // 10
=========================================
Follow the link for next video:
[ Ссылка ]
Follow the link for previous video:
[ Ссылка ]
=========================================
C Programming Tutorials Playlist:
- [ Ссылка ]
=========================================
Watch My Other Useful Tutorials:-
Computer Programming Fundamentals Playlist:-
[ Ссылка ]_
C Practical LAB Exercises Playlist:-
[ Ссылка ]
C++ Tutorials Playlist:
[ Ссылка ]
=========================================
► Subscribe to our YouTube channel:
[ Ссылка ]
► Visit our Website:
[ Ссылка ]
=========================================
Hash Tags:-
#ChidresTechTutorials #CProgramming #CProgrammingTutorial
One Dimensional Arrays in C - C Programming Tutorial 69
Теги
one dimensional array in cone dimensional array in c programmingone dimensional array in c languageone dimensional array in c programming examples1 d array in c programming1 dimensional array in ctypes of array in carrays in c languagearrays in c programmingc tutorialc programmingc language tutorialc programming tutorialc programming tutorialsprogramming language tutorialchidres tech tutorials cchidres tech tutorialsmanjunath chidre