. Consider the following program
main()
{
int a[5]={1,3,6,7,0};
int *b;
b=&a[2];
}
The value of b[-1] is
(A) 1 (B) 3 (C) -6 (D) none
Answers were Sorted based on User's Feedback
Answer / sujay
I think the answer is none
bcoz b is a pointer var so, it points to an ad location
the answer is not any of the given options
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / veerendra
here b is an pointer. u r askng the value stored in a b's
array of -1....pointer may not be array here..
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / sandip talukder
answer is(B). coz b holds d adrs ofa[2].so b[0]is 6. thats
why b[-1] is 3.
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / megh singh rana
HERE address of location a[2] assined to b .now b stre this
data in o location as b[0],so b[-1] is the value immediate
before b[0]( 6) is 3,thats why answer of b[-1] is 3,
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / bipin chandra sai.s
ans is none,bcoz b has been assigned address &[2],but it
has been asked that ans for b[-1],so the location -1 is not
there,we have locations from 0,1,2,3..,so none is the ans
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / harichandana
a[2] value is assigned to b i.e a[2] element value 6 is stored in b[0].now b[-1] means element before 6 i.e 3....thus b[-1] is 3
Is This Answer Correct ? | 1 Yes | 0 No |
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
What are conditional operators in C?
How do I determine whether a character is numeric, alphabetic, and so on?
Why string is used in c?
What is type qualifiers?
union { char ch[10]; short s; }test; test.s = 0xabcd; main() { printf("%d",ch[10]); }
when will be evaluated as true/ if(x==x==x) a) x=1; b) x=0; c) x=-1; d) none
Explain how can I open a file so that other programs can update it at the same time?
a<<1 is equivalent to a) multiplying by 2 b) dividing by 2 c) adding 2 d)none of the above
Write a program that accepts a string where multiple spaces are given in between the words. Print the string ignoring the multiple spaces. Example: Input: “ We.....Are....Student “ Note: one .=1 Space Output: "We Are Student"
Write a program to interchange two variables without using the third variable?
17 Answers Accenture, College School Exams Tests, Infotech,
Explain how can I pad a string to a known length?