C++ Programming Tutorial – 10 – Introduction to Arrays

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

22 responses to “C++ Programming Tutorial – 10 – Introduction to Arrays”

  1. Foxhound Tactical Avatar

    I learned more from you then my professor, thx

  2. Sofia Lafitte Avatar

    Thanks for this tutorial! It really helped!

  3. Anime 4 You Avatar

    hey do you know how to print the least occured digit in an array like 1004, 2111,8?

  4. Bradley Speakman Avatar

    ' i like spelling things '

  5. Willem Beltman Avatar

    You start counting at zero because you are referencing a integer at the memory position of your bacon variable with a offset of: (index between brackets) * (size of array element). Using a index of 1 would result in a offset of 1 integer, so the first 32 bits would never be used.

    Say the compiler has memory location #1000 free of resources and you assign the bacon variable with the line:

    int bacon[5]={12,43,54,3,897};

    Then the variable "Bacon" will get memory location #1000

    If you then look in memory it will look like this:

    Byte #1000 till #1003: "12"
    Byte #1004 till #1007: "43"
    Byte #1008 till #1011: "54"
    Byte #1012 till #1015: "3"
    Byte #1016 till #1019: "897"

    If you then want the first value, you will need position: 1000 + (index * sizeof(integer)) = 1000 + (0 * 4 bytes) = 1000

    So, when using the line:

    cout << bacon[2];

    You are telling the program to cout 4 bytes (as a integer) starting from memory location: 1000 + 2 * 4 = 1008, which is the 3rd item.

  6. Djno0dle Avatar

    hahaha =))) all i can say is that is damn fun to watch this tuts. :)))

  7. The New Gamer Avatar

    why dont you do some tutorials for how to do games in dev c++

  8. Sam Cool Avatar

    excellent work sire!! 🙂

  9. Arturo Quiroz Avatar

    Pretty good, I understood every word you said, even that I don't speak too much English xD

  10. Francine Andrea Avatar

    thanks, very helpful 🙂

  11. rip Presents Avatar

    Good lord! ur voice sounds so Angelic. 

  12. Ben Dillon Avatar

    Ok.. I'm using dev c++ and when I try to run this, I get a bunch of compiler errors unless I have using namespace std in the body of the main function. I thought once it's within the body of the program directly below include <iostream> that it was automatically included in every function. What am I doing wrong?

  13. Deed Baloch Avatar

    you're not boring as my teacher…Love your tutorials.. thanks for making these awesome tuts

  14. Mohd Amir Avatar

    Dude , u are awesome ! i can see where i make a mistake on my program as u were xplaining ! thanks a lot !

  15. Jonathan Nayin Avatar

    Thanks! You just broke it down for me! . "An array is a variable that holds multiple values" By the way , I love you and I am STRAIGHT!!! lol

  16. Jkp Avatar

    you're awesome! :DDD

  17. Jim West Avatar

    And they start with zero as to incorporate all possible digits. If it started at 1, 0 wouldn't be in that set.

  18. Jim West Avatar

    Variable=Object Better to say an array is an object because it is C++. C++ is an object-oriented programming language. Array's are objects. Not really variables

  19. 8042 Avatar

    Translation (not that it needed it): I don't understand this.

  20. Lupara Bianca Avatar

    Because they don't browse YouTube.

  21. Ian Gabriel Sanchez Avatar

    if he really is, then, why doesn't he get an award from guinness?

Leave a Reply

Your email address will not be published. Required fields are marked *