小编nan*_*.kl的帖子

'new' 未声明(首次在此函数中使用)

此代码用于哈密顿循环我无法解决此错误:

    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

0
推荐指数
1
解决办法
9866
查看次数

标签 统计

c ×1