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 |
Is there a way to switch on strings?
What is a memory leak in structures? How can we rectify that?
What is type qualifiers?
Tell me can the size of an array be declared at runtime?
WHAT IS ABSTRACT DATA TYPE
What is the process to create increment and decrement stamen in c?
difference between c and c++
what are bit fields in c?
wat are the two methods for swapping two numbers without using temp variable??
Program to find larger of the two numbers without using if-else,while,for,switch
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
Find the output? void main() {float a=2.0; printf("\nSize of a ::%d",sizeof(a)); printf("\nSize of 2.0 ::%d",sizeof(2.0));}
11 Answers IBM, TCS,