A
al3x4nder
look this code:
#include <stdio.h>
#define length(arr) sizeof(arr)/sizeof(arr[0])
void func(int arr[]){
printf("func(): length(arr) = %d\n", length(arr));
}
void main(void){
int i, arr[] = {1,2,3};
printf("main(): length(arr) = %d\n", length(arr));
func(arr);
}
and, please, explain me, why length() macro
works with differences in different context?
stupid question? oh...
#include <stdio.h>
#define length(arr) sizeof(arr)/sizeof(arr[0])
void func(int arr[]){
printf("func(): length(arr) = %d\n", length(arr));
}
void main(void){
int i, arr[] = {1,2,3};
printf("main(): length(arr) = %d\n", length(arr));
func(arr);
}
and, please, explain me, why length() macro
works with differences in different context?
stupid question? oh...