T
Te-Jung Lo
the following is the original code i wrote
#include <stdio.h>
#include <stdlib.h>
//--- Prototype ---//
void bfs(int []);
void main()
{
int mess[64] = { 0, 1, 1, 0, 0, 0, 0, 0,
1, 0, 0, 1, 1, 0, 0, 0,
1, 0, 0, 0, 0, 1, 1, 0,
0, 1, 0, 0, 0, 0, 0, 1,
0, 1, 0, 0, 0, 0, 0, 1,
0, 0, 1, 0, 0, 0, 0, 1,
0, 0, 1, 0, 0, 0, 0, 1,
0, 0, 0, 1, 1, 1, 1, 0 };
bfs(mess); // Breadth First Search
}
void bfs(int mess[8][8])
{
for(int i=0; i < 64; i++)
printf("%d ", mess);
}
i've tried to pass a 2-D array to function with VC++ 6.0 compiler. There is
all right in compiler process, but two errors in link process as follows:
-----------------------------------------------------------------
Linking...
test.obj : error LNK2001: unresolved external symbol "void __cdecl bfs(int *
const)" (?bfs@@YAXQAH@Z)
Debug/test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
test.exe - 2 error(s), 0 warning(s)
-------------------------------------------------------------------
i know 2-D array is actually a line of memory space, so it would be correct
if change mess[8][8] into mess[64]
But is there another declaration can direct attain the goal(pass 2-D array
into a function)
thanks !
#include <stdio.h>
#include <stdlib.h>
//--- Prototype ---//
void bfs(int []);
void main()
{
int mess[64] = { 0, 1, 1, 0, 0, 0, 0, 0,
1, 0, 0, 1, 1, 0, 0, 0,
1, 0, 0, 0, 0, 1, 1, 0,
0, 1, 0, 0, 0, 0, 0, 1,
0, 1, 0, 0, 0, 0, 0, 1,
0, 0, 1, 0, 0, 0, 0, 1,
0, 0, 1, 0, 0, 0, 0, 1,
0, 0, 0, 1, 1, 1, 1, 0 };
bfs(mess); // Breadth First Search
}
void bfs(int mess[8][8])
{
for(int i=0; i < 64; i++)
printf("%d ", mess);
}
i've tried to pass a 2-D array to function with VC++ 6.0 compiler. There is
all right in compiler process, but two errors in link process as follows:
-----------------------------------------------------------------
Linking...
test.obj : error LNK2001: unresolved external symbol "void __cdecl bfs(int *
const)" (?bfs@@YAXQAH@Z)
Debug/test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
test.exe - 2 error(s), 0 warning(s)
-------------------------------------------------------------------
i know 2-D array is actually a line of memory space, so it would be correct
if change mess[8][8] into mess[64]
But is there another declaration can direct attain the goal(pass 2-D array
into a function)
thanks !