#define DIM( array, type) sizeof(array)/sizeof(type)

main()

{

int arr[10];

printf(“The dimension of the array is %d”, DIM(arr,
int));

}



#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]..

Answer / susie

Answer :

10

Explanation:

The size of integer array of 10 elements is 10 *
sizeof(int). The macro expands to sizeof(arr)/sizeof(int) =>
10 * sizeof(int) / sizeof(int) => 10.

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More C Code Interview Questions

void main() { char ch; for(ch=0;ch<=127;ch++) printf(“%c %d \n“, ch, ch); }

1 Answers  


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

0 Answers   Honeywell,


why array index always strats wuth zero?

2 Answers  


main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }

2 Answers  


main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }

2 Answers   HP,


main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }

7 Answers  


how to check whether a linked list is circular.

11 Answers   Microsoft,


Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

1 Answers  


Develop a routine to reflect an object about an arbitrarily selected plane

0 Answers  


#include<stdio.h> #include<conio.h> void main() { int a=(1,2,3,(1,2,3,4); switch(a) { printf("ans:"); case 1: printf("1");break; case 2: printf("2");break; case 3: printf("1");break; case 4: printf("4");break; printf("end"); } getch(); }

0 Answers  


main() { int i=5; printf(“%d”,i=++i ==6); }

1 Answers  


How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”)

4 Answers   HCL,


Categories