M
M
MIKHAN_GO2022-01-27 21:16:41
C++ / C#
MIKHAN_GO, 2022-01-27 21:16:41

How does fill accept an array multiplied by a long long?

Given this code:

#include  <iostream>
#include <algorithm>

using namespace std;
int main() {
    long long n;
    cin >> n;
    int a[1000000];
    fill(a, a+n, 1);
    return 0;
}

Why does fill() take a value like array+long long? (2nd argument)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wataru, 2022-01-27
@MIKHAN_GO

Pointer Arithmetic . This results in a pointer to the last element of the array, like ::end() for collections.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question