cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
sizeof() works in main() but not in func
sizeof() works in main() but not in function
Oct 26, 2011 at 7:10pm UTC
targt123
(30)
void myfunction (int ar[])
{
cout<<sizeof(ar)<<endl;
}
int main ()
{
int arr[3] = {1,2,3};
cout<<sizeof(arr)<<endl;\\ this gives answer 12
myfunction(arr);\\ this gives answer 4
}
I get two different sizes of same array. Why? Thanks.
Oct 26, 2011 at 7:17pm UTC
JMJAtlanta
(142)
See :
http://www.cplusplus.com/forum/general/19458/
Topic archived. No new replies allowed.