Which command is more efficient?
*(ptr+1) or ptr[1]

Answers were Sorted based on User's Feedback



Which command is more efficient? *(ptr+1) or ptr[1]..

Answer / priya

*(ptr+1)

Is This Answer Correct ?    5 Yes 2 No

Which command is more efficient? *(ptr+1) or ptr[1]..

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

Which command is more efficient? *(ptr+1) or ptr[1]..

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

Post New Answer

More C Interview Questions

Program to display given 3 integers in ascending order

1 Answers   N Tech,


Can 'this' pointer by used in the constructor?

1 Answers  


main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); }

4 Answers   CitiGroup,


How can I increase the allowable number of simultaneously open files?

1 Answers   CSC,


Rapunzel walks into the forest of forgetfullness. She meets a Lion who lies on Monday Tuesdays and Wednesdays and meets a rabbit who lies on Thurs fridays and saturdays . On that day both say that "I lied yesterday". What day is it .

3 Answers   TCS,


implement general tree using link list

1 Answers   Wipro,


How many types of operator or there in c?

1 Answers  


how do you execute a c program in unix.

1 Answers  


Why c is called procedure oriented language?

1 Answers  


What’s the special use of UNIONS?

1 Answers   ADP,


What is the Lvalue and Rvalue?

2 Answers  


Write a C program to fill a rectangle using window scrolling

1 Answers  


Categories