#include <iostream> #include <fstream> #include <string> using namespace std; class LinkedListedStack { struct Node { int* data; Node* prev; }; public: LinkedListedStack() { top = nullptr; } void push(int a,int b) { Node* temp = new Node; if (top == nullptr) { temp->data = new int[2]{ a,b }; temp->prev = nullptr; top = temp; } else { temp->data = new int[2]{ a,b }; temp->prev = top; top = temp; } }; int* pop() { if (top == nullptr)return nullptr; else { int* data = top->data; Node* temp = top->prev; delete top; top = temp; } }; int* pick() { if (top == nullptr)return nullptr; else { return top->data; } }; void destory() { while (top != nullptr) { Node* temp = top->prev; delete top; top = temp; } } private: Node* top; }; void MazeEscape(bool (&bVisited)[16][16],char (&mat)[16][16]) { } int main() { ifstream cin("input.txt"); int N; char mat[16][16]; bool bVisited[16][16]; LinkedListedStack ls; for (int i = 0; i < 10; i++) { cin >> N; memset(bVisited, false, sizeof(bVisited[0][0]) * 16 * 16); for (int j = 0; j < 16; j++) { cin >> mat[j]; for (int k = 0; k < 16; k++) { if (mat[j][k] == '2') { // 시작위치 찾기 ls.push(j,k); bVisited[j][k] = true; } } } MazeEscape(bVisited, mat); } return 0; }



여기서 MazeEscape에 매개변수로 배열 ref 넘길수 있는 방법이 지금 내가 사용한 방법밖에없나?

더효율적이거나 간단한 방법없음?