Which command is more efficient?
*(ptr+1) or ptr[1]
Answers were Sorted based on User's Feedback
Answer / purna
*(ptr+1);
Internally the same operation is performed with the next
one also.
it takes less time.
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / 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 |
what are the files which are automatically opened when a c file is executed?
How can I do peek and poke in c?
Explain what is the benefit of using enum to declare a constant?
What is clrscr ()?
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
what is op? for(c=0;c=1000;c++) printf("%c",c);
write a program for odd numbers?
What are the average number of comparisons required to sort 3 elements?
who is the editor of 'pokemon'?
What are run-time errors?
Function calling procedures? and their differences? Why should one go for Call by Reference?
write the program to find multiplication of 2-D matrix??????????