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

Why is c so powerful?

677


Why do we need functions in c?

551


Is it cc or c in a letter?

556


Explain c preprocessor?

678


Array is an lvalue or not?

631






can we change the default calling convention in c if yes than how.........?

2028


What is the difference between array and pointer?

560


What is the difference between class and object in c?

578


What is pass by reference in c?

603


When is a null pointer used?

633


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

1793


Give me the code of in-order recursive and non-recursive.

878


What is the maximum no. of arguments that can be given in a command line in C.?

661


Is it possible to pass an entire structure to functions?

548


What is bash c?

550