Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

punteros a arrays

// C++ program to demonstrate that compiler
// internally uses pointer arithmetic to access
// array elements.
#include <iostream>
using namespace std;
 
int main()
{
    int arr[] = { 100, 200, 300, 400 };
 
    // Compiler converts below to *(arr + 2).
    cout << arr[2] << " ";
 
    // So below also works.
    cout << *(arr + 2) << " ";
 
    return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #punteros #arrays
ADD COMMENT
Topic
Name
5+4 =