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


Please Help Members By Posting Answers For Below Questions

int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;

1394


Why is event driven programming or procedural programming, better within specific scenario?

2170


What does dm mean sexually?

1048


what are the advantages of a macro over a function?

880


How do you search data in a data file using random access method?

1092


What is c value paradox explain?

800


What do you know about the use of bit field?

813


write a program for the normal snake games find in most of the mobiles.

2022


Explain the difference between #include "..." And #include <...> In c?

802


What is the difference between scanf and fscanf?

890


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

863


How can you find the day of the week given the date?

851


Why is c called c not d or e?

843


write a programming in c to find the sum of all elements in an array through function.

1925


Can math operations be performed on a void pointer?

760