<s>[INST] Given a 2D array of integers and a target sum, determine whether it is possible to construct a path from the top-left to the bottom-right that sums up to the target value. The path can only go either down or right from any cell, and each cell can only be visited once.

Here is a basic structure for solving this problem using depth-first search (DFS):
```
bool hasPath(int** grid, int gridSize, int* gridColSize, int target) {
    // TO DO: implement the solution
}
```
Please help me complete this function. 

Also, please suggest a way to do this iteratively. 

The function signature is in C style and might look different in other languages. For example, in Java or C#, the function might be like `boolean hasPath(int[][] grid, int target)`.

The `gridSize` is the number of rows, and the `gridColSize` is the number of columns.

Here is an explanation of the problem:

You are given a 2D grid of integers. Can you find a path from the top-left cell to the bottom-right cell such that the sum of the numbers you step on is equal to the given target sum?[/INST]