Skip to content

Illustrating the Relationship between Array and Pointers  #1586

Open
@11gurmeet11

Description

@11gurmeet11

#include < iostream >

using namespace std;

int main()
{
// Defining an array
int arr[ ] = { 1, 2, 3, 4 };

// Define a pointer
int* ptr = arr;

// Printing address of the arrary using array name
cout << "Memory address of arr: " << &arr << endl;

// Printing address of the array using ptr
cout << "Memory address of arr: " << ptr << endl;

return 0;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions