int DIM(int array[])

{

return sizeof(array)/sizeof(int );

}

main()

{

int arr;

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

}

Answers were Sorted based on User's Feedback

int DIM(int array[]) { return sizeof(array)/sizeof(int ); } mai..

1

Explanation:

Arrays cannot be passed to functions as arguments and only
the pointers can be passed. So the argument is equivalent to
int * array (this is one of the very few places where [] and
* usage are equivalent). The return statement becomes,
sizeof(int *)/ sizeof(int) that happens to be equal in this
case.

 Is This Answer Correct ? 8 Yes 1 No

int DIM(int array[]) { return sizeof(array)/sizeof(int ); } mai..

Answer / manoj kumar

Arrays cannot be passed to functions as arguments and only
the pointers can be passed.

 Is This Answer Correct ? 1 Yes 0 No

More C Code Interview Questions

why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

main() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }

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

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

Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector

main() { char not; not=!2; printf("%d",not); }

char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }

Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.

char *someFun1() { char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }

program to Reverse a linked list

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

#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

Categories
• C Code (421)
• C++ Code (127)
• VC++ Code (17)
• Java Code (84)
• Dot Net Code (114)
• Visual Basic Code (11)
• Programming Code AllOther (62)