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)
Answer Posted / 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 ? | 5 Yes | 1 No |
Post New Answer View All Answers
What is structure padding in c?
Which programming language is best for getting job 2020?
What is the difference between exit() and _exit() function in c?
What is getch() function?
What do you mean by invalid pointer arithmetic?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
What is a list in c?
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
What is difference between class and structure?
What are the types of data files?
Explain how does flowchart help in writing a program?
How can I do peek and poke in c?
What is the difference between typedef struct and struct?
Explain what is the most efficient way to store flag values?
How will you write a code for accessing the length of an array without assigning it to another variable?