zeroval doesn’t change the i in main, but zeroptr does because it has a reference to the memory address for that variable.
In Co-array Fortran, pointers work differently from some other languages. They are more like references and must be associated with a target before use. The => operator is used for pointer assignment.
The loc() function is used to get the memory address of a variable, which is similar to the & operator in some other languages.
Note that Co-array Fortran is an extension of Fortran and may require specific compiler support. The -coarray=single flag is used here for simplicity, but in a true co-array program, you might use multiple images for parallel execution.