Write a small MACRO to calculate the size of the array (elements in an array)
#include<stdio.h>
#define size_calc(arr) (sizeof(arr)/sizeof(*arr))
void main()
{
int array[10] = {5,6,7};
int size = size_calc(array);
printf("%d\n", size);
}
Write a small MACRO to calculate the size of the array (elements in an array)
#include<stdio.h>
#define size_calc(arr) (sizeof(arr)/sizeof(*arr))
void main()
{
int array[10] = {5,6,7};
int size = size_calc(array);
printf("%d\n", size);
}
0 Comments