#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

#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 Answers  


find A^B using Recursive function

2 Answers  


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

2 Answers  


write a c-program to find gcd using recursive functions

5 Answers   HTC, Infotech,


main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O

4 Answers   HCL,






main() { signed int bit=512, mBit; { mBit = ~bit; bit = bit & ~bit ; printf("%d %d", bit, mBit); } } a. 0, 0 b. 0, 513 c. 512, 0 d. 0, -513

3 Answers   HCL, Logical Computers,


How can you relate the function with the structure? Explain with an appropriate example.

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  


C statement to copy a string without using loop and library function..

2 Answers   Persistent, TCS,


main() { int i =0;j=0; if(i && j++) printf("%d..%d",i++,j); printf("%d..%d,i,j); }

1 Answers  


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


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

2 Answers   HP,


Categories