#19 C Arrays | C Programming For Beginners

Поділитися
Вставка
  • Опубліковано 4 лип 2024
  • #19 C Arrays | C Programming For Beginners
    In this video, you will learn about array in C Programming. You will learn to declare, initialize and access elements of an array with the help of examples. In addition to that you will have clear concept on using array with loops and index out of bound errors that you may face while using an array.
    This video is a part of our C Programming video series: • #1: Getting Started wi...
    ~
    Resources:
    C Online Compiler: www.programiz.com/c-programmi...
    Github File: github.com/programiz/c-youtub...
    C (title) Tutorial (text-based tutorial): www.programiz.com/c-programmi...
    Timestamps:
    00:00 Start
    00:18 C Arrays
    00:51 Syntax for array declaration
    01:46 Assign Value to Array
    03:23 Array index
    05:33 Assign Values using index number
    07:58 Change Array Elements
    09:09 Loop and Array
    11:32 Index Out of bound Error
    12:28 Programming Task
    13:07 Quiz
    ~
    Revise your learning using our C App
    Download here for Android: bit.ly/3upaInx
    Download here for iOS: apple.co/3EZLtNq
    Find Programiz elsewhere:
    Facebook: / programiz
    Instagram: / _programiz
    LinkedIn: / programiz
    Website: www.programiz.com
    Twitter: / programiz
    #programiz #carray #cprogramming #learnc #array #loop

КОМЕНТАРІ • 302

  • @programizstudios
    @programizstudios  2 роки тому +20

    🔥Finding it Damn Hard to Understand C Programming?
    Learn to code-the right way-with interactive lessons, quizzes & challenges. Build a strong programming base; it's IMPORTANT!
    Try Programiz PRO for Free: bit.ly/master-c-programming

    • @AbhiramDeshpande-fe1vi
      @AbhiramDeshpande-fe1vi Рік тому +2

      #include
      int main() {
      int marks[5]={50,66,78,84,92};
      int average = (marks[0]+marks[1]+marks[2]+marks[3]+marks[4])/5;
      printf(" the average marks is : %d",average);
      return 0;
      }

    • @shondeabreu5542
      @shondeabreu5542 Рік тому

      @@AbhiramDeshpande-fe1vi I made mine a bit more complex lol.

  • @SauravKumar-vj7ks
    @SauravKumar-vj7ks 2 роки тому +28

    Awesome and crisp explanation. Keep making more videos to cover the entire language. Your series is really very crisp ,informational and easily understandable.

  • @hrushikeshtodkari5265
    @hrushikeshtodkari5265 2 роки тому +21

    I Like your teaching method. keep posting such contents free for the student.
    thank you.....

  • @ashenafigodana
    @ashenafigodana Рік тому +5

    clear, concise and to the point explanation Thank you.

  • @2snish
    @2snish 2 роки тому +3

    Thank you !
    Great explanation,Simple but precise and also great initiative on making this videos available to all !

  • @danielmalatji1813
    @danielmalatji1813 10 місяців тому +1

    am yet to find best teacher thank you for your content it really makes it easier to learn and grasp info on c programming.

  • @war.blitzee7985
    @war.blitzee7985 Рік тому +1

    Thank you very much for these videos. Your websites also give excellent content. Keep up the great work.

  • @linbz2784
    @linbz2784 Місяць тому

    this is helping me a lot, i always use programiz terminal when i want to try something quick and it is really helpful. Now those classes are helping me understand even more.

  • @prathikantamsaivarnith484
    @prathikantamsaivarnith484 Рік тому +4

    #include
    int main() {
    int marks[5];
    for(int i=0;i

  • @Honest_Reply900
    @Honest_Reply900 2 місяці тому

    One of the best teaching method, please go ahead and make more contents like this

  • @expecttheunexpected6717
    @expecttheunexpected6717 2 роки тому +1

    Excellent to understanding... Tqsm mam...

  • @MupenziJeanFelix-wk9rx
    @MupenziJeanFelix-wk9rx Рік тому +1

    hello. I like however you teach or share us about your skills. thank you alot.

  • @dryadsharaz
    @dryadsharaz Місяць тому

    Haa nhasi ndopandatozonzwisisa ma array after a long time. Well done parohwa basa apa🙌🤝

  • @olusamuel7672
    @olusamuel7672 Рік тому +15

    The Quiz answer is 0, no digit is stored in that index so automatically it's 0.
    Between I love the way you teach, you make C look easy and have really really learnt a lot from your channel. good job ❤😊

  • @nyangparker4195
    @nyangparker4195 2 місяці тому +1

    woah! you are great in explaining c programming. sorry my English is not that good, but yours was good enough to make me understand it very well. thankyou! i hope to see more videos from you!

  • @mohammadabdullahaalforhad1375
    @mohammadabdullahaalforhad1375 7 місяців тому

    your understanding is so good

  • @peterabdallah7555
    @peterabdallah7555 2 роки тому +1

    Very very helpful,thank you keep it up

  • @nihatdonmzov4166
    @nihatdonmzov4166 Рік тому +1

    Thank you so much for the video !

  • @teddymacdesley
    @teddymacdesley 17 днів тому

    Thabks alot this woll surely hwlp me for today HND exams i have .

  • @shivaprasad._.08
    @shivaprasad._.08 Рік тому

    Superb explanation 🙏

  • @umarsquare4328
    @umarsquare4328 7 місяців тому

    I really like your explanation.....

  • @Saint-Phillemon
    @Saint-Phillemon 11 днів тому

    I love her english, so different and unique to grasp even better

  • @jessamiee88
    @jessamiee88 Рік тому +1

    thank you very very very much, you help me a lot

  • @ravikumarronad7475
    @ravikumarronad7475 Рік тому +34

    Correct Answer is C. 0
    Array of size is 5 so in the given array have 3 elements so remaining 4th and 5th index number store automatically 0 value.
    Pictorial is:
    Int num[5]= { 2, 3, 5, 0, 0}
    Important Note: Array is Collection of Homogenous elements.

    • @akashmathdevru8618
      @akashmathdevru8618 10 місяців тому +2

      no it show random no....because in video saw put value 6 nut it can present 0--4 integer remaining it get random no. so i think D

    • @TiTan-gr3pv
      @TiTan-gr3pv 10 місяців тому +5

      ​@@akashmathdevru8618in that case the value she asked for was out of the size of the array so it gave a random value but if you don't store any value willingly inside a particular index of an array the value 0 will be stored in many compilers and some may show an error so it doesn't give an output of a random value

  • @jdram82
    @jdram82 Рік тому

    Great Explanation, Thank you for the same.

  • @naomywitherwhy129
    @naomywitherwhy129 Рік тому +2

    in the for loop you had an input of 16 but printed out as 6 in the compiler, what could be the problem

  • @SumitSingh-ov6ws
    @SumitSingh-ov6ws 2 роки тому +19

    Programming task: /*Create a program that computes the average marks of a student.
    Create and array that stores the marks of 5 subjects;
    Compute the total marks by adding all the marks;
    Divide the total marks by the total number of subjects;
    Print the average marks. */
    #include
    main()
    {
    int i;
    int sum=0;
    int marks[5];
    for(i=0;i

    • @bansarithakker7661
      @bansarithakker7661 9 місяців тому +1

      Thnx broo

    • @ntwadumela7
      @ntwadumela7 7 місяців тому +2

      Good but its good programming practice that you initialize avg as int avg and then add avg=sum/5 and print it.

    • @andrewsterling895
      @andrewsterling895 6 місяців тому +1

      I suggest you remove the printf("Entre the marks "); out of the for loop.

    • @josuealcala6255
      @josuealcala6255 2 місяці тому

      I appreciate this. I missunderstood the wording of the quiz and this made me understand what she was asking for

  • @sanayounas8014
    @sanayounas8014 Рік тому

    I Like your teaching method. keep posting such contents free for the student. Thank you answer is 0

  • @bullgamerdoga9293
    @bullgamerdoga9293 Рік тому

    best channel ever thank you hanım abla

  • @pravinsingh3453
    @pravinsingh3453 Рік тому

    Thank you mam give more things of array,🥰🥰

  • @saladevamanikanta6788
    @saladevamanikanta6788 2 роки тому +3

    mam! i did it, lots of thanks for you by adding the addition points to it. Thanks a lot mam.
    /* Create a program that computes the average marks of a
    student.
    1. Create an array that stores the marks of n subjects.
    2. Compute the total marks by adding all the marks.
    3. Divide the total marks by total number of subjects.
    4. Compute the percentage.
    5. Print the average marks and percentage and total marks. */
    #include
    #include
    int main()
    {
    int subs, subs1, total_marks = 0, array[100], entire_total;
    float average, percentage;
    clrscr();
    printf("Enter how many subjects you have: ");
    scanf("%d", &subs);
    printf("The Entire Total marks of the subjects are: ");
    scanf("%d",&entire_total);
    for(subs1 = 0; subs1 < subs; subs1++)
    {
    printf("Enter the score in subject%d : ", subs1);
    scanf("%d", &array[subs1]);
    }
    for(subs1 = 0; subs1 < subs; subs1++)
    {
    total_marks = total_marks + array[subs1];
    }
    average = (float)total_marks / subs;
    percentage = ((float)total_marks / entire_total ) * 100;
    printf("
    The Total marks of the subjects out of %d : %d", entire_total,total_marks);
    printf("
    The Average marks of the subjects are: %.3f", average);
    printf("
    The Percentage of all subjects according to your marks: %.3lf %", percentage);
    getch();
    return 0;
    }

  • @dexterstudytool
    @dexterstudytool 14 днів тому

    nice class and this are best in business

  • @jagdishshinde4383
    @jagdishshinde4383 Рік тому

    Assomone explanation mam👍👍👍👍

  • @saiphanikrishnathallam5599
    @saiphanikrishnathallam5599 7 місяців тому

    Great and simply explained too good
    And the answer is( c) . 0

  • @user-mr3mf8lo7y
    @user-mr3mf8lo7y Рік тому

    Thanks a bunch.

  • @stealthy_doctor2384
    @stealthy_doctor2384 Місяць тому

    wonderful explanation, i think the answer to the quiz is C. 0 and for the task:
    #include
    #include
    int main() {
    // Write C code here
    int age[6];
    int sum;
    int average;
    printf("Enter 5 Subject's Grades: ");
    for(int i =0;i

  • @shadyzmartinez
    @shadyzmartinez 3 місяці тому +1

    i found it interesting 😊 i like it

  • @arjunsavitha466
    @arjunsavitha466 Рік тому +1

    Thank you mam 😊

  • @RailExpressbyPreetam
    @RailExpressbyPreetam Рік тому

    Nice explanation mam

  • @novafenice5745
    @novafenice5745 Рік тому +3

    #include
    #include
    int main(){
    float grades[5];
    int i;
    float sum = 0;
    for(i = 0; i < 5; i++){
    printf("Inserect grades: ");
    scanf("%f", &grades[i]);
    sum = sum + grades[i];
    }
    float average = sum/5;
    printf("The average marks is: %.2f", average);
    return 0;
    }

  • @Patrickbateman622
    @Patrickbateman622 2 роки тому

    Thank you.

  • @christiangomezcastillo4383
    @christiangomezcastillo4383 Рік тому

    Animo joel tu puedes

  • @vishnureddy6098
    @vishnureddy6098 Рік тому

    May I know where we can use new line character "/n"

  • @okwalingalawrence258
    @okwalingalawrence258 Рік тому

    thanks a lot

  • @xxcfirexx8980
    @xxcfirexx8980 3 місяці тому

    so good👌

  • @Aditya-fu4jj
    @Aditya-fu4jj Рік тому

    Thankyou!

  • @swapnildargude284
    @swapnildargude284 2 роки тому +3

    #include
    int main()
    {
    int marks[5];
    int i,sum=0,average;
    printf("Enter marks of 5 subjects");
    for (i = 0; i

  • @murti1565
    @murti1565 Рік тому +3

    i love it when she says "jero"

  • @BWM.LIFE-FOUNDATION-tv
    @BWM.LIFE-FOUNDATION-tv 6 місяців тому

    Nice my teacher 🙏🙏🎉🎉

  • @batuhanerkek2874
    @batuhanerkek2874 Рік тому

    Arrays is very easy with you.

  • @pashamreddy7926
    @pashamreddy7926 Рік тому +6

    at 11.30 why did the output come as 6 instead of 16 ?

    • @ElHipokondriako
      @ElHipokondriako Рік тому

      I did notice too. Just guessing, but might be a bug in the compiler?

  • @sanviarora4034
    @sanviarora4034 2 роки тому

    helpful video

  • @prajwal_bagewadi
    @prajwal_bagewadi Рік тому

    very nice video 😊😊😊❤❤❤🙏mam

  • @Queen_Kenara_Music
    @Queen_Kenara_Music 8 місяців тому

    Happy programming 🎉

  • @ebukaokereke8341
    @ebukaokereke8341 8 місяців тому

    Do a video of array using DEV C++

  • @divineabazie8918
    @divineabazie8918 Рік тому

    i love your videos

  • @KpopRumbleAlliance
    @KpopRumbleAlliance 2 місяці тому

    great vide

  • @prabeshpoudel9115
    @prabeshpoudel9115 5 місяців тому

    Beautiful

  • @growth_vd
    @growth_vd Рік тому

    i dont get it in the last part of hte video u ask one quesetion it ans will be random number

  • @NOFAP22
    @NOFAP22 2 роки тому +2

    👌

  • @augustinekamara-kz2hb
    @augustinekamara-kz2hb Рік тому

    Great

  • @user-iz2et4kj9y
    @user-iz2et4kj9y Рік тому

    thanks

  • @lunganispider
    @lunganispider Рік тому

    ❤thanks

  • @bandulajagathkumara1038
    @bandulajagathkumara1038 Рік тому

    I love her accent ❤️☺️

  • @AM-yd8en
    @AM-yd8en 7 місяців тому

    8:48 why the output is not 25, and what if i want 25 what should i do?

  • @Jeff-qr8eo
    @Jeff-qr8eo Місяць тому

    I understand this more than from my class lol.

  • @waleedd857
    @waleedd857 4 місяці тому +2

    thanks! but why do you pronounce g as z an z as g?

  • @sohamalhat_
    @sohamalhat_ Рік тому

    It was Good!

  • @ordealkarisa1517
    @ordealkarisa1517 Рік тому +1

    Wow I like the way you pronounce zero. You're the best 👌 ever 💓

  • @SilicioouGrafeno
    @SilicioouGrafeno 24 дні тому

    When changing the value of the array age[2] from 25 to 26, why wasn't it changed directly inside the int function? 8: 48 is the video time. Someone please help me understand this.

  • @tripodshedbymuyengwa7014
    @tripodshedbymuyengwa7014 2 роки тому +1

    int main()
    {
    int ave,sum;
    int student_marks[5];
    printf("Enter student marks :",student_marks[5]);
    scanf("%d%d%d%d%d",&student_marks[5]);
    {
    sum=student_marks[5]++;
    printf("Total mark is :
    ",sum);
    }

    ave=sum/5;
    printf("Avarage mark is:%d",ave);

    return 0;
    }

  • @mahesherukala2679
    @mahesherukala2679 2 роки тому

    sister upload continuation videos too plz

  • @AM-yd8en
    @AM-yd8en 8 місяців тому

    11:28 shouldn’t printf be in scanf’s place and vice versea?

  • @RasuvChandanshive-hm8oz
    @RasuvChandanshive-hm8oz 6 місяців тому

    I love programmiz😊😊😊 5:11

  • @bibeklimbu-nt4ff
    @bibeklimbu-nt4ff 2 місяці тому

    guyz haru ta nepali po raixan so proud of that

  • @ananyatak5121
    @ananyatak5121 11 місяців тому

    programming task-
    int marks[5];
    printf(" Enter the marks of 5 different subjects of a student:");
    for (int i=0; i

  • @hrushikeshtodkari5265
    @hrushikeshtodkari5265 2 роки тому +6

    D. Random value

    • @dhanushs1802
      @dhanushs1802 2 роки тому +1

      I guess you haven't considered the size of the array, so it is 0.

  • @Saurabhekka22
    @Saurabhekka22 Рік тому +1

    I might be wrong but the answer to the question in the end is Random value, option (D)

  • @anesp.a913
    @anesp.a913 Рік тому +3

    The output of that code is option (d) Random Value

    • @maxwell4466
      @maxwell4466 Рік тому +1

      That's what I thought, apparently their github repository says different.

    • @iam__aj37
      @iam__aj37 10 місяців тому

      @@maxwell4466 Can you provide me their gitHub repository link?

  • @parkwanff1743
    @parkwanff1743 10 днів тому

    int main(){
    int n;
    printf("Enter the number of subjects
    ");
    scanf("%d",&n);
    float a[n];
    float sum=0.0;
    float average;
    for(int i=0;i

  • @pravyjha4567
    @pravyjha4567 Місяць тому +1

    At 11:25 why u used ++i instead of i++

  • @user-lf2xu1xm3y
    @user-lf2xu1xm3y 9 місяців тому +1

    double number[5];
    printf("Enter the number: ");
    scanf("%lf %lf %lf %lf %lf", &number[0],&number[1],&number[2],&number[3],&number[4]);
    double add = (number[0]+number[1]+number[2]+number[3]+number[4]);
    double sum = add / 5;
    printf("%lf", sum);

  • @mek059
    @mek059 Рік тому +5

    At 11:30 it printed 6 instead of 16 .. Why? 😳

  • @ElHipokondriako
    @ElHipokondriako Рік тому +2

    11:27 somehow returned "6" instead of "16" in age[3]?

  • @keshavdixit08
    @keshavdixit08 Рік тому

    #include
    int main()
    {
    int marks_sub[5] = {60,70,54,82,50};
    float total_marks=0, avg_marks;
    //total_marks = marks_sub[0] +
    for (int i=0;i

  • @imrannazari8642
    @imrannazari8642 Рік тому

    #include
    int main(){
    int marks[5];
    float total;
    for (int i = 0; i < 5; i++)
    {
    scanf("%d",&marks[i]);
    }
    for (int i = 0; i < 5; i++)
    {
    total = marks[i] + total;
    }
    int mark = sizeof(marks)/sizeof(marks[0]);
    total = total / mark;
    printf("the average marks is %.2f ",total);

    }

  • @abhijeettechverse7
    @abhijeettechverse7 2 роки тому +1

    Ans is - D. Random value because we are trying to access uninitialized value

  • @marusukech.5049
    @marusukech.5049 2 роки тому

    programming task:
    #include
    int aver(int total){
    int average = total / 5;
    return average;
    }
    int main(){
    int subjects[5];
    printf("Enter the marks:");
    for(int i = 0;i < 5;++i){
    scanf("%d", &subjects[i]);
    }
    int total;
    for(int i = 0;i < 5;++i){
    total = total + subjects[i];
    }
    int average = aver(total);
    printf("
    Average marks: %d", average);
    return 0;
    }

  • @programizstudios
    @programizstudios  2 роки тому +19

    [Programiz Video Quiz]
    Q. Which value will we get when we print num[4] from the following array?
    int num[5] = {2, 3, 5};
    1. 2
    2. 5
    3. 0
    4. Random Value

  • @fairooznadia8955
    @fairooznadia8955 Рік тому +3

    #include
    int main()
    {
    int i;
    double avg;
    double marks[5];
    printf("Enter marks of 5 subjects:");
    for(i=0 ;i

  • @KpopRumbleAlliance
    @KpopRumbleAlliance 2 місяці тому

    #include
    int main() {
    // Create an array that stores the marks of 5 subjects
    int marks[] = {75, 80, 85, 90, 95};
    // Compute the total marks by adding all the marks
    int total_marks = 0;
    for (int i = 0; i < 5; i++) {
    total_marks += marks[i];
    }
    // Divide the total marks by total number of subjects
    int number_of_subjects = sizeof(marks) / sizeof(marks[0]);
    float average_marks = (float)total_marks / number_of_subjects;
    // Print the average marks
    printf("Average marks: %.2f
    ", average_marks);
    return 0;
    }

  • @ultimatebhai1821
    @ultimatebhai1821 Рік тому

    hey please make always new code for new type like new when you start for loop please i request

  • @user-jt3dx4zv3u
    @user-jt3dx4zv3u Рік тому +4

    #include
    int main(){
    double marks[5], sum = 0.0;
    for(int i = 0; i < 5; i++){
    printf("Insert marks:", marks[i]);
    scanf("%lf", &marks[i]);
    sum += marks[i];
    }
    double average = sum / 5;
    printf("The average marks is: %lf ", average);
    return 0;
    }

  • @omaeshebl4732
    @omaeshebl4732 Рік тому

  • @lamaspacos
    @lamaspacos 3 місяці тому

    11:30 and 11:55 A problem with the 4th element ! (?)😅

  • @Sara.j-hk4my
    @Sara.j-hk4my Рік тому

    #include
    int main( )
    { int marks[5], i;
    int sum=0;
    float avg;
    for(i=0;i

  • @deekshipalanivel2027
    @deekshipalanivel2027 Рік тому

    Random value will be printed.

  • @ranjithn0605
    @ranjithn0605 8 місяців тому +1

    #include
    int main() {
    // Write C code here
    int marks[5]={56,45,67,87,56};
    int totalMarks = marks[0] + marks[1] + marks[2] + marks[3] + marks[4];
    double averageMarks= totalMarks/5.0;
    printf("The total marks scored = %d
    ",totalMarks);
    printf("The averageMark = %.2lf
    ",averageMarks);
    return 0;
    }

  • @sohupba7122
    @sohupba7122 Рік тому

    منورين

  • @user-ob7te4hq5c
    @user-ob7te4hq5c 7 місяців тому

    d. random value