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 does the message "automatic aggregate intialization is an ansi feature" mean?
program to find the second largest word in a paragraph amongst all words that repeat more thn twice
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
What is the diffences between Windows XP and Windows Visa
How can I change the size of the dynamically allocated array?
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); }
how to execute a program using if else condition and the output should enter number and the number is odd only...
What are preprocessor directives in c?
What is call by reference in functions?
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
What are qualifiers?
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?