Photo by Kelly Sikkema on Unsplash

Programming

Pointers questions

What is a3 equal to?

              int main() {
                int a2[] = {1, 2, 3, 4, 5, 6};
                int a3 = (1 + 3)[a2] - a2[0] + (a2 + 1)[2];
              }             
        

What will the following program output to the console:

              #include <iostream>
              int main(){
                int a[]= {1,1,1,1, 1,1,1,1, 1,1,1,1};
                *((long long *)a + 2) = 0;
                for(int i = 0; i < 12; i++) {
                    std::cout << (int)a[i] << " ";
                }
              }          
        

Useful resources

  1. Beginning C++17 : From Novice to Professional last arrival in the TSI library
  2. C++ Tutorials well known tutorial website
  3. C++ another online reference
  4. DariaEmacs inspiring website about C++