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

How can I split up a string into whitespace-separated fields?

0 Answers  


#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?

6 Answers   NDS,


How can we see the Expanded source code and compiled code for our source program in C?

1 Answers  


What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ?

3 Answers  


What does %p mean c?

0 Answers  


Why do we need a structure?

0 Answers  


please explain every phase in the "SDLC" in the dotnet.

0 Answers  


sir, i cannot find the way how to write aprogram by using array on queue

1 Answers   IISIT,


what is the maximum limit of row and column of a matrix in c programming. in linux .

4 Answers   NIIT,


Are local variables initialized to zero by default in c?

0 Answers  


program for swapping two strings by using pointers in c language

1 Answers  


What are c header files?

0 Answers  


Categories