If array identifiers are compiled to addresses, how are variables any different? The question was asked in a comment to this video: https://youtu.be/bFAO99USrYI?si=28lVj_f5xbP1BawV Here, I explain what variables really are and how values are assigned to them. In order to understand that we have to dig down a bit deeper than just C code by looking at the debug information in the Disassembly Windows of Visual Studio. ARRAYS AND REGISTERS In this video, I’ve tried to keep the Disassembly as simple as possible so that programmers unfamiliar with Assembly Language can follow along. For the benefit of more experienced programmers, bear in mind that when indexing an array, the EAX register stores the “stride” (data element size) of the array elements. So for a char it will be 1, for an int it will be 4. For a long long it will be 8 and so on. For simplicity, in this video I index a char array at 1, so EAX stores the value 1 (1 byte, the size of a char, at index 1). When using other indices the Disassembly will show various additional instructions to calculate offsets from this index. That’s beyond the scope of this video but, if there is sufficient interest, I may do more videos in future looking at Intel Assembly Language in more detail. If you are having problems with addresses, arrays, pointers and pointer arithmetic, you may want to look at some of my other lessons: Are array variables special types of pointers? https://youtu.be/H18yIPSsgLg?si=SZ4HmyI76UelxMkT A low-level look at arrays and addresses: https://youtu.be/bFAO99USrYI?si=XEKZk842R3oGXEr- A Really Simple Guide to Pointers: https://youtu.be/HfQTXWEcTUQ?si=9LzykUai6YBP29ut MORE LESSONS ============= To watch other videos about “low level programming”, go to the “Down To The Metal” playlist: https://www.youtube.com/playlist?list=PLZHx5heVfgEt8Ynevr3OX9UBKLPXdSMGM Also, my series on “Programming C in Visual Studio”: https://www.youtube.com/playlist?list=PLZHx5heVfgEvL826uk3DeeUy1QiP7nrIs Be sure to subscribe to the Code With Huw channel so that you get a notification when I upload more lessons in this series. PROGRAMMING BOOKS ==================== If you want to learn programming in more depth (and also support this channel!) you might think of buying one of my books. I have written books on C programming, Using Pointers in C, Recursion and other programming topics. You can buy my books (paperback or Kindle) on Amazon. *** The Little Book Of Pointers *** Amazon (US) https://amzn.to/2LF2aVb Amazon (UK) https://amzn.to/2FViSvS *** The Little Book Of C Programming *** Amazon (US) https://amzn.to/2RXwA6a Amazon (UK) https://amzn.to/2JhlwOA “CODE WITH HUW” ON TWITTER: ================================= https://twitter.com/codewithhuw “CODE WITH HUW” ON FACEBOOK: ================================= https://www.facebook.com/CodeWithHuw Good luck! And good programming!