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

pointer_variable=(typecasting datatype*)malloc(sizeof(datatype)); This is the syntax for malloc?Please explain this,how it work with an example?

2 Answers   eClerx, Excel, kenexa,


Find the largest number from the given 2 numbers without using any loops and the conditional operator.

2 Answers  


write a program to rearrange the array such way that all even elements should come first and next come odd

0 Answers  


Given an array of numbers, except for one number all the others occur twice. Give an algorithm to find that number which occurs only once in the array.

6 Answers  


how can I convert a string to a number?

0 Answers  






What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

0 Answers   Aspire, Infogain,


What is a const pointer?

0 Answers  


How to swap two values using a single variable ? condition: Not to use Array and Pointer ?

6 Answers  


What does c mean in basketball?

0 Answers  


How to implement call back functions ?

3 Answers   HP,


#include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); } what is the output for this?

4 Answers   IIIT,


explain about storage of union elements.

2 Answers   ABC, Bosch,


Categories