given the piece of code
int a[50];
int *pa;
pa=a;
to access the 6th element of the array which of the
following is incorrect?
a.*(a+5)
b.a[5]
c.pa[5]
d.*(*pa + 5)

Answers were Sorted based on User's Feedback



given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the a..

Answer / karthik

void main()
{
int a[50]={1,2,3,4,1,55};
int *pa;
pa=a
printf("%d",*(pa+5));
}

we will the sixth element

its not pointer to the pointer ie *(*pa+5);

Is This Answer Correct ?    36 Yes 3 No

given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the a..

Answer / fazlur rahaman naik

d is the right answer.

Is This Answer Correct ?    19 Yes 2 No

given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the a..

Answer / jaya prakash

Answer is D.
It is not a pointer to pointer.So we cannot use two stars.

Is This Answer Correct ?    6 Yes 1 No

given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the a..

Answer / yatish m yadav

The wrong answer is
d> *(*pa+5)
here value pointed to by pa is accessed and added 5 to it
then trying to print the value at that address, which gives
us an warning with some garbage value.

Is This Answer Correct ?    4 Yes 1 No

given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the a..

Answer / vignesh1988i

d) is the wrong choice...... because , first variable pa
refers to a address of the array... * of that pa will give
you the first value of the array.. ie a[0] , then that value
will be getting added with 5 and the * which is outside wont
have any value towards this manuplation...... so this will
show an error...... illegal use of pointers.....


thank u

Is This Answer Correct ?    2 Yes 0 No

given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the a..

Answer / shivangi

c is the wrong answer

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More C Interview Questions

write a c program to print "Welcome" without using semicolon in the whole program ??

15 Answers   Infosys, TCS,


what are far pointers?

1 Answers  


What is an volatile variable?

15 Answers   HP,


why programming language C is still used in operating system's kernel??

1 Answers   Wipro,


Find the largest number from the given 2 numbers without using any loops and the conditional operator.

2 Answers  






write a program to concatenation the string using switch case?

0 Answers  


Write the test cases for checking a variable having value in range -10.0 to +10.0?

0 Answers   Bosch,


What are the back slash character constants or escape sequence charactersavailable in c?

0 Answers  


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

0 Answers   Lovely Professional University,


c program to subtract between two numbers without using '-' sign and subtract function.

2 Answers  


What do you understand by normalization of pointers?

0 Answers  


Reverse the part of the number which is present from position i to j. Print the new number. eg: num=789876 i=2 j=5 778986

1 Answers  


Categories