filmov
tv
Arrays in C | C Arrays - C Programming Tutorial 67

Показать описание
Notes for You:: Arrays in C.
What is an array?
- An array is a group of homogeneous data elements
- i.e. collection of similar type of data elements.
Note:
- Arrays follow 0 based indexing
Note:
- Each element in an array is going to have an index or a subscript,
- hence sometimes arrays are also called as indexed variables or subscripted variables.
Why do we need arrays?
- Assume if you want to store and process n different integer values, then without arrays you may need to create n different integer variables with n different names;
- whereas an integer array allows us to store and process n different integer values just by creating a single variable.
Note:
- Arrays allow us to group of similar type of data elements under a single variable name.
Example Code:
#include <stdio.h>
int main()
{
/*
int num1 = 10;
int num2 = 20;
int num3 = 30;
int num4 = 40;
int num5 = 50;
printf("%d\n",num1);
printf("%d\n",num2);
printf("%d\n",num3);
printf("%d\n",num4);
printf("%d\n",num5);
*/
int numbers[5] = {10,20,30,40,50};
int i=0;
for(i=0; i<5;i++)
{
printf("%d\n",numbers[i]);
}
return 0;
}
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for previous video:
C Programming Tutorial 68 - Types of Arrays in C Programming Language
Follow the link for previous video:
C Programming Tutorial 66 - Print Pyramid Pattern of Numbers and Stars in C Programming
=========================================
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
What is an array?
- An array is a group of homogeneous data elements
- i.e. collection of similar type of data elements.
Note:
- Arrays follow 0 based indexing
Note:
- Each element in an array is going to have an index or a subscript,
- hence sometimes arrays are also called as indexed variables or subscripted variables.
Why do we need arrays?
- Assume if you want to store and process n different integer values, then without arrays you may need to create n different integer variables with n different names;
- whereas an integer array allows us to store and process n different integer values just by creating a single variable.
Note:
- Arrays allow us to group of similar type of data elements under a single variable name.
Example Code:
#include <stdio.h>
int main()
{
/*
int num1 = 10;
int num2 = 20;
int num3 = 30;
int num4 = 40;
int num5 = 50;
printf("%d\n",num1);
printf("%d\n",num2);
printf("%d\n",num3);
printf("%d\n",num4);
printf("%d\n",num5);
*/
int numbers[5] = {10,20,30,40,50};
int i=0;
for(i=0; i<5;i++)
{
printf("%d\n",numbers[i]);
}
return 0;
}
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for previous video:
C Programming Tutorial 68 - Types of Arrays in C Programming Language
Follow the link for previous video:
C Programming Tutorial 66 - Print Pyramid Pattern of Numbers and Stars in C Programming
=========================================
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
Комментарии