c'apps Answer Pl check our answer and correct
Answer: SomeGarbagevalue---10
Explanation:
In this 3-dimensional array maximal index values are
1.
expression
&p[2][2][2] address the element far beyond the array area. It is a
programmers error, although the compiler does not check it. The system may
indicate it as general protection error.
***a
is just first element of the array (type int), but *q is defererencing
uninitialized pointer, the value would be stored in some random memory cell,
which is the second serious error of the
same type : memory
allocation
Answer : 50
Explanation:
The preprocessor directives can be redefined anywhere in the program. So
the most recently assigned value will be taken
sizeof(void *)=2
sizeof(int *)=2
sizeof(double *)=2
sizeof(struct unknown *)=2
Explanation:
The pointer to any type is of same size.
Answer: 64
Explanation:
The
macro call squre(4) will substituted by 4*4 so the expression becomes
i=64/4*4.since / and* has equal priority the expression will be evaluated
as(64/4)*4 i.e. 16*4=64
Answer: c=2;
Explanation:
Here unary
minus(or negation operator is used twice. Same maths rules applies, ie. Minus *
minus=plus.
Note:
However you
cannot give like --2. Because --
operator can only be applied to variables as a decrement operator (eg., i--). 2
is a constant and not a variable.
Answer:
1111
2424
3737
4242
5555
6868
7373
8686
9999
Explanation:
*(*(p+i)+j)
is equivalent to p[i][j].
P+I andi+p mean the same, although it is very rarely used
H
Explanation:
* is a dereference operator
& is a reference operator. They can be applied any number of times provided
it is meaningful
Answer: 10
Explanation:
he size of integer
array of 10 elements is 10 * sizeof(int). The macro expands to
sizeof(arr)/sizeof(int) => 10 * sizeof9int)/sizeof =>10.
Answer : 1 2
Explanation: The sizeof()
operator gives the number of bytes taken by its operand. P is a Character
pointer, which needs one byte for storing its value(a character). Hence sizeof(*p)
gives a value of 1. Since it needs two bytes to store the address of the
character pointer sizeof(p) gives 2.
Answer: Infinite loop
Explanation:
The difference between the previous
question and this one is that the char is declared to be unsigned. So the i++
can never yield negative value and i>=0 Never becomes false so that it can come out of the for loop
No comments:
Post a Comment