Which command is more efficient?
*(ptr+1) or ptr[1]
Answer Posted / poornima
If ptr is declared as a pointer like int *ptr; *(ptr+1) is
more efficient.
If ptr is declared as an array like int ptr[20]; ptr[1] is
more efficient.
So, it depends upon how we r declaring ptr as a pointer or
as an array.
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
What is extern keyword in c?
Explain how are portions of a program disabled in demo versions?
What does emoji p mean?
Explain how do you generate random numbers in c?
Explain how can I open a file so that other programs can update it at the same time?
How many levels of indirection in pointers can you have in a single declaration?
What are the different types of errors?
What are pointers in C? Give an example where to illustrate their significance.
What is derived datatype in c?
Why use int main instead of void main?
How do you determine a file’s attributes?
What is a pointer and how it is initialized?
Explain how are 16- and 32-bit numbers stored?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
What are 'near' and 'far' pointers?