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 |
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.
write a program to rearrange the array such way that all even elements should come first and next come odd
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.
how can I convert a string to a number?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
What is a const pointer?
How to swap two values using a single variable ? condition: Not to use Array and Pointer ?
What does c mean in basketball?
How to implement call back functions ?
#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?
explain about storage of union elements.