KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an array defined in a file and in another I have to use it, for e.g- /* a.c - defines an array */ int a[] = {1,2,3,4,5,6,7,8,9}; /* b.c - declare and use it. */ #define COUNT ((sizeof a)/(sizeof int)) extern int a[]; //size of array . . . int i; for(i=0; i<COUNT; i++) printf("%d", a[i]); . . . Now when I try to compile it it gave me error saying that sizeof cann't be used on incomplete type. Can anybody tell me how to handle such case in C/C++? I don't want to array subscript in a.c Thanks in advance
Tags (comma-separated)
Save Edits
Cancel