Developer community
0 votes
33 views
I had the definition char x[6] in one source file, and in another I declared extern char *x. Why didn't it work?
asked by Advisor (5.6k points) 1 7 14 | 33 views

1 Answer

0 votes
Hi Daniel,

The declaration extern char *x simply does not match the actual definition. The type "pointer-to-type-T" is not the same as "array-of-type-T." Use extern char x[].

References: CT&P Sec. 3.3 pp. 33-4, Sec. 4.5 pp. 64-5.
answered by

Related questions

+1 vote
2 answers
0 votes
1 answer
asked by allison Sr Member (1.5k points) 11 26 40 | 80 views
0 votes
1 answer
asked by albertina Geek (15.7k points) 5 9 21 | 1.6k views
0 votes
1 answer
asked by carlton Sr Member (4k points) 5 11 21 | 1k views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

3,751 questions
4,046 answers
117 comments
10,709 users