What is the real difference between arrays and pointers?
Answer Posted / jaroosh
Arrays are simply pointers THAT CANNOT be reassigned, ie,
constant pointers to some memory locations. They do not
"magically preserve" any information about array size or
whatever that some suggest, they are just a type of constant
pointers, nothing more.
For example , the following :
int a[] = {1,23};
a++;
will throw a compiler error, something like : a is not an
Lvalue, which means that you cannot assign or change the
value of a.
| Is This Answer Correct ? | 64 Yes | 14 No |
Post New Answer View All Answers
How can I implement sets or arrays of bits?
What is the ANSI C Standard?
What are the different properties of variable number of arguments?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
Explain what does the format %10.2 mean when included in a printf statement?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
Where register variables are stored in c?
What is the difference between declaring a variable and defining a variable?
When should structures be passed by values or by references?
Can include files be nested?
What does 1f stand for?
Write a program to print "hello world" without using a semicolon?
Why do we need arrays in c?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
What is the difference between typedef and #define?