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 |
How can I split up a string into whitespace-separated fields?
#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared like DCHAR ch1, ch2; TCHAR ch3, ch4; then what will be types of ch1, ch2, ch3 and ch4?
How can we see the Expanded source code and compiled code for our source program in C?
What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ?
What does %p mean c?
Why do we need a structure?
please explain every phase in the "SDLC" in the dotnet.
sir, i cannot find the way how to write aprogram by using array on queue
what is the maximum limit of row and column of a matrix in c programming. in linux .
Are local variables initialized to zero by default in c?
program for swapping two strings by using pointers in c language
What are c header files?