R
rahul8143
hello,
why following 2 codes does not give same result that is 10?
1)
#include <stdio.h>
#define DIM(array) sizeof(array)/sizeof(int)
void main()
{
int arr[10];
printf("The dimension of the array is %d", DIM(arr));
}
2)
#include <stdio.h>
int DIM(int array[])
{
return (sizeof(array)/sizeof(int));
}
void main()
{
int arr[10];
printf("The dimension of the array is %d", DIM(arr));
}
why following 2 codes does not give same result that is 10?
1)
#include <stdio.h>
#define DIM(array) sizeof(array)/sizeof(int)
void main()
{
int arr[10];
printf("The dimension of the array is %d", DIM(arr));
}
2)
#include <stdio.h>
int DIM(int array[])
{
return (sizeof(array)/sizeof(int));
}
void main()
{
int arr[10];
printf("The dimension of the array is %d", DIM(arr));
}