#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

Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)

7 Answers   Microsoft,


main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit = (bit >> (i - (i -1)))); } } a. 512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d. 64, 32, 16, 8, 4

2 Answers   HCL,


Is this code legal? int *ptr; ptr = (int *) 0x400;

1 Answers  


How we print the table of 3 using for loop in c programing?

7 Answers  


String reverse with time complexity of n/2 with out using temporary variable.

10 Answers   NetApp, Symantec,






main() { int *j; { int i=10; j=&i; } printf("%d",*j); }

9 Answers   HCL, Wipro,


main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }

1 Answers  


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

1 Answers  


What is your nationality?

1 Answers   GoDB Tech,


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() { char str1[] = {‘s’,’o’,’m’,’e’}; char str2[] = {‘s’,’o’,’m’,’e’,’\0’}; while (strcmp(str1,str2)) printf(“Strings are not equal\n”); }

1 Answers  


4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }

2 Answers   Broadridge,


Categories