How to use the Const type pointer in C ++ across files

zhaozj2021-02-11  201

By two files: main.cpp, fun.cpp Test the cross-document of the Const type pointer

// main.cpp

#include

Char * const str = new char [100];

Void fun ();

void main ()

{

STRCPY (STR, "Hello");

Fun ();

}

// fun.cpp

#include

EXTERN CHAR * CONST STR;

Void fun ()

{

COUT << str << endl;

}

As a result, fun.obj can't find STR when connecting, is this?

转载请注明原文地址:https://www.9cbs.com/read-5071.html

New Post(0)