#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

How to read a directory in a C program?

4 Answers  


Program to find the largest sum of contiguous integers in the array. O(n)

11 Answers  


#define a 10 void foo() { #undef a #define a 50 } int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } explain the answer

1 Answers  


Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number

2 Answers   Ace Info,


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  






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

1 Answers  


#include<stdio.h> int main() { int x=2,y; y=++x*x++*++x; printf("%d",y); } Output for this program is 64. can you explain how this output is come??

1 Answers  


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

1 Answers  


Write, efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).

13 Answers   Intel, Microsoft, TCS,


main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

2 Answers  


how to swap 3 nos without using temporary variable

4 Answers   Satyam,


You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.

3 Answers  


Categories