Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

size of array

If all you have is the pointer to the first element then you can't:

int array[6]= { 1, 2, 3, 4, 5, 6 };
void main() 
  {
  int *parray = &(array[0]);
  int len=sizeof(array)/sizeof(int);
  printf("Length Of Array=%d
", len);
  len = sizeof(parray);
  printf("Length Of Array=%d
", len);
  getch();
}
// output: Will give two different values: 6, and 4.
Source by www.codeproject.com #
 
PREVIOUS NEXT
Tagged: #size #array
ADD COMMENT
Topic
Name
8+6 =