Sumit wrote:I'm struggling to understand the difference between a pointer and array. And when to use which?
Any help.
Thanks.
Sumit
Boy you need to do homework. Read K&R's C Programming Language, aka The C Bible.
I would make your life easier just remember these 2 definitions
Array: A variable which has same type of elements in it.
Pointer: A variable which contains address of another variable.
They can be used interchangeably, you can use any of them to achieve same purpose.
But when it comes to use them pointers go messy.
Welcome to the "C" world.