S
Sunil Varma
other.cpp
----------------
int arr[10] = {0};
main.cpp
----------------
#include <iostream>
using namespace std;
extern int arr[];
void main()
{
cout<<sizeof(arr)<<endl;
}
When I try to build the above code, I'm getting the following
compilation error.
f:\programs\nest\nest\main.cpp(23) : error C2070: 'int []': illegal
sizeof operand
I would like to know the reason why I get a compilation error.
When I change the extern to
extern int *arr;
the code compiles properly.
Thanks in anticipation.
Sunil
----------------
int arr[10] = {0};
main.cpp
----------------
#include <iostream>
using namespace std;
extern int arr[];
void main()
{
cout<<sizeof(arr)<<endl;
}
When I try to build the above code, I'm getting the following
compilation error.
f:\programs\nest\nest\main.cpp(23) : error C2070: 'int []': illegal
sizeof operand
I would like to know the reason why I get a compilation error.
When I change the extern to
extern int *arr;
the code compiles properly.
Thanks in anticipation.
Sunil