Day#76 'C' Coding Challenge

Day#76 'C' Coding Challenge

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);

}

Post a Comment

0 Comments