TCS
Company
Programming
Arrays
Is there any difference int the following declarations?
int fun(int arr[]);int fun(int arr[2]);
A.Yes
B.No
Read Solution (Total 10)
-
- No, both the statements are same. It is the prototype for the function fun() that accepts one integer array as an parameter and returns an integer value.
- 6 years agoHelpfull: Yes(4) No(1)
- in 1st function declaration there is no specification of the size of array it accepts i.e. it can take an array of any size, but in second function declaration there is size of array specified so it can accept the array of almost size 2,then How can these two statements be same.
- 5 years agoHelpfull: Yes(4) No(0)
- no, because these are prototype function.
- 6 years agoHelpfull: Yes(0) No(0)
- ans is B
because both are same prototypes - 6 years agoHelpfull: Yes(0) No(0)
- no. Declaration is same.
- 6 years agoHelpfull: Yes(0) No(0)
- B.no , both are same
- 6 years agoHelpfull: Yes(0) No(0)
- Ans Is:- Error , Because b,c,d undefined.
- 6 years agoHelpfull: Yes(0) No(5)
- An answer is an option: B
Because, both the statements are the same. It is the prototype for the function fun() that accepts one integer array as a parameter and returns an integer value. - 3 years agoHelpfull: Yes(0) No(0)
- yes. in first function there is no declaration of array size while second has.
- 1 year agoHelpfull: Yes(0) No(0)
- Yes because in the first declaration size is not specified which will give error while in the second declaration size is defined
- 4 Months agoHelpfull: Yes(0) No(0)
TCS Other Question
What will be the output of the program ?
#include
int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
1. 2, 1, 15
2. 1, 2, 5
3. 3, 2, 15
4. 2, 3, 20
Are the expressions arr and &arr same for an array of 10 integers?
A.Yes
B.No