Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

size of array

#include <stdio.h>
#include <stdlib.h>

void printSizeOf(int intArray[]);
void printLength(int intArray[]);

int main(int argc, char* argv[])
{
    int array[] = { 0, 1, 2, 3, 4, 5, 6 };

    printf("sizeof of array: %d
", (int) sizeof(array));
    printSizeOf(array);

    printf("Length of array: %d
", (int)( sizeof(array) / sizeof(array[0]) ));
    printLength(array);
}

void printSizeOf(int intArray[])
{
    printf("sizeof of parameter: %d
", (int) sizeof(intArray));
}

void printLength(int intArray[])
{
    printf("Length of parameter: %d
", (int)( sizeof(intArray) / sizeof(intArray[0]) ));
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #size #array
ADD COMMENT
Topic
Name
2+9 =