Message from C, C++ discussions

December 2019

— Lol why you don't use monospace font


Void fun(int arr[])
int i;
int arr_size = sizeof(arr)/sizeof(arr[0]);
for (i = 0; i < arr_size; i++)
printf("%d ", arr[i]);

int main()
int i;
int arr[4] = {10, 20 ,30, 40};
return 0;

— OUTPUT produces 8 4 and 10 20

— Can someone explain me how 8 is the size of the array

— Wtf

— Don't use sizeof/sizeof

— It doesn't work

— Use a variable to pass the size

— Why are you trying to calculate the size of array when you already know? pass an extra argument in the function for array size

Message permanent page

— This was a tell the output kind of the question...

— Well as off now i know.. That pointer to the array Iss passed in the functions...

— The size of variables depends on the system and the compiler you are using