which of 'arrays' or 'pointers' are faster?
Answers were Sorted based on User's Feedback
array is faster than pointer because accessing array elements
by pointers always faster.there is used one array and more pointer.we know pointer is a "value at address".
so pointers stores only address of variable but arrays are stores similar data types.
Is This Answer Correct ? | 10 Yes | 1 No |
Answer / andeep singh
Pointer is faster than array if there is only one pointer used
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / narendra
arrays are very faster because it stores a sequential
block of memory and similar data types
pointers stores only adders of variable
but arrays are stores similar data types
Is This Answer Correct ? | 9 Yes | 4 No |
Answer / sandeep
when compared pointers work fast ,beacause:
1.array too is pointer
eg:char s[20];
gets(s);
here we are supplying base address.
2.array notation will be inter coverted as pointers
where we can directly use pointers.
Is This Answer Correct ? | 0 Yes | 0 No |
#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2 = 5; printf ( "\n The sum is :%d", value1 | value2 ); } This is the answer asked by some one to add two numbers with out using arithmetic operator?Yes this answer is write it given out put as 15.But how????? what is need of following line? int main ( int argc, char* argv [ ] ) how it work?what is the meaning for this line? please explain me.Advance thanks
How do you prevent buffer overflows in C?
Display names and numbers of employees who have 5 years or more experience and salary less than Rs.15000 using array of structures (name, number, experience and salary)
Hi, main() { } Is a user defined function or Built in Functionn
Give a fast way to multiply a number by 7
15 Answers Accenture, Aricent, Microsoft,
Q.11 Generate the following pattern using code in any language(c/c++/java) for n no. of rows 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
How are portions of a program disabled in demo versions?
main() { float a=3.2e40; printf("%d",a); }
What is the condition that is applied with ?: Operator?
Can a pointer be static?
write a program to check whether a given integer is a strong number or not? [Hint: 145=1!+4!+5! =1+24+120 =145]
What is meant by errors and debugging?