N
Newsgroup - Ann
Hi gurus,
I have two files compiled together. One file has the following global
definition:
char s[] = "asdf";
Another file has the following declaration:
extern char *s;
Is there anything wrong here? I know that although char* s and char s[] are
not exactly the same, and in most case, they are interchangable. However,
when I use them in separate files, there are problems:
When I assign the value of s to another char * type local variable like
char *p = s;
Instead of the pointer s itself being assigned to the p, the value pointed
by s is assgined to p. That's certainly not my intention. I know roughly to
say, that's because the different view from the two source files, but how is
the detail? Has anybody here ever experienced similar problems? btw, I am
using Visual C++. Could it be a bug of VC++?
News - Ann
I have two files compiled together. One file has the following global
definition:
char s[] = "asdf";
Another file has the following declaration:
extern char *s;
Is there anything wrong here? I know that although char* s and char s[] are
not exactly the same, and in most case, they are interchangable. However,
when I use them in separate files, there are problems:
When I assign the value of s to another char * type local variable like
char *p = s;
Instead of the pointer s itself being assigned to the p, the value pointed
by s is assgined to p. That's certainly not my intention. I know roughly to
say, that's because the different view from the two source files, but how is
the detail? Has anybody here ever experienced similar problems? btw, I am
using Visual C++. Could it be a bug of VC++?
News - Ann