此代码用于哈密顿循环我无法解决此错误:
In function ‘hamCycle’:
error: ‘new’ undeclared (first use in this function)
int *path = new int [V];
^
note: each undeclared identifier is reported only once for each function it appears in
error: expected ‘,’ or ‘;’ before ‘int’
int *path = new int [V];
^
Run Code Online (Sandbox Code Playgroud)
哈密顿循环代码是:
/*
* C Program to Find Hamiltonian Cycle
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define V 5
void printSolution(int path[]);
/*
* check if the vertex v can be added at …
Run Code Online (Sandbox Code Playgroud) c ×1