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

What does the message "automatic aggregate intialization is an ansi feature" mean?

0 Answers  


program to find the second largest word in a paragraph amongst all words that repeat more thn twice

4 Answers   CTS, iGate,


what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; a.9 b.8 c.6 d.7

4 Answers   TCS,


What is the diffences between Windows XP and Windows Visa

1 Answers   Aricent, FHF,


How can I change the size of the dynamically allocated array?

0 Answers  






main() { int x=5,y=10,z=0; x=x++ + y++; y=y++ + ++x; z=x++ + ++y; printf("%d%d%d\n",x,y,z); }

1 Answers   CodeChef,


how to execute a program using if else condition and the output should enter number and the number is odd only...

0 Answers  


What are preprocessor directives in c?

0 Answers  


What is call by reference in functions?

1 Answers  


Struct(s) { int a; long b; } Union (u) {int a; long b; } Print sizeof(s)and sizeof(u) if sizeof(int)=4 and sizeof(long)=4

2 Answers   Mascot,


What are qualifiers?

0 Answers  


what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?

0 Answers  


Categories