Question:
Difference between arrays and pointers?
Answer:
Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to by them<br><br>Arrays use subscripted variables to access and manipulate data.Array variables can be equivalently written using pointer expression. Source: CoolInterview.com
DIFF BETWEEN ARRAY AND POINTER<br>Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to by them<br><br>Ø Arrays use subscripted variables to access and manipulate data.Array variables can be equivalently written using pointer expression. <br>© CoolInterview.com<br><br><br><br> Source: CoolInterview.com
Answered by: DHARAM PAL | Date:
| Contact DHARAM PAL
Pointers are used to manipulate data by using address or they are address variable used to store address.Pointers use * operator to access data.<br>Array are used to store data of same data type and they are denoted or stored by same name.They use continuous memory allocation and use subscripted variables.Eg int A[50]<br>'A' is name of array which can store 50 data of integer type and denoted by A[0]A[1]...A[49]. Source: CoolInterview.com
Answered by: Priyanka Dutta | Date: 3/31/2009
| Contact Priyanka Dutta
Pointers are used to manipulate data by using address or they are address variable used to store address.Pointers use * operator to access data.<br>Array are used to store data of same data type and they are denoted or stored by same name.They use continuous memory allocation and use subscripted variables.Eg int A[50]<br>'A' is name of array which can store 50 data of integer type and denoted by A[0]A[1]...A[49]. Source: CoolInterview.com
Answered by: Priyanka Dutta | Date: 3/31/2009
| Contact Priyanka Dutta
pointer are stored a memory location of any other variable.<br>and array is a group memory cells.which stored a data per cell. Source: CoolInterview.com
Answered by: vijay sharma | Date: 4/4/2009
| Contact vijay sharma
Difference between Array and Pointer -<br><br>Array:<br><br>int ar[10] - Arrays are fixed size and address that 'ar' holds can not be changed it is fixed throughout the scope.<br><br><br>Pointer: <br><br>int *P = (int *)malloc(sizeof(int)*10);<br><br>above statement will alocate an memory of type integer and data holding capacity is 10.<br><br>free(p); // free allocted memory.<br><br><br>p = (int *)malloc(sizeof(int)*20);<br><br>now here we are changing 'size as well as value of 'p' that is address hold by 'p' as weell.<br><br>Pointers provide flexible way to deal with run time allocations.<br><br><br>Also you can perform '++' operation on pointer ( p++ ) but you can not perform '++' operation on Arrays. ( ar++ ia an error! ).<br><br><br><br><br> Source: CoolInterview.com
Answered by: Prasad | Date: 4/17/2009
| Contact Prasad
array s are constant pointers, the address of starting element would be stored in name of array. whose position cannot be changed <br><br>ordinary pointer contains address of any element and the address what it has can be changed Source: CoolInterview.com
Answered by: hari babu | Date: 5/20/2009
| Contact hari babu
Arrays are call to the pointers by using the symbol ->(arrow). <br> pointers are used * operatur to access the data &also pointed to the address. Source: CoolInterview.com
Answered by: chunduri Indira | Date: 5/21/2009
| Contact chunduri Indira
?Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to by them<br><br>?Arrays use subscripted variables to access and manipulate data.Array variables can be equivalently written using pointer expression.<br><br>DIFF BETWEEN ARRAY AND POINTER<br>Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to by them<br><br>?Arrays use subscripted variables to access and manipulate data.Array variables can be equivalently written using pointer expression.<br><br> Source: CoolInterview.com
Answered by: nithyaraj | Date: 5/25/2009
| Contact nithyaraj
Pointers are used to manipulate date using thir address location which gives high speed process of performance level.<br><br>Array is collection of data elements represent as sequancial order. if you using pointer traverse the array with minimal changes of address location bacause of subsequent address of data stored Source: CoolInterview.com
Answered by: vijay | Date: 5/29/2009
| Contact vijay
Arrays-Array is a set of Similar data types, It is collection of similar Elements Stored In Contigous form In memory And Each element has Some adress. <br>Pointers - Pointers are Basically Used to acess To the adress OF the Elements Stored In Memory. It is also Used to acess to the element in the array as well as adress of the element in that array. Source: CoolInterview.com
Answered by: Rahul | Date: 6/15/2009
| Contact Rahul
Pointer is a variable that store adress of other variable.<br>Array is a subscripted variable that store similar type of data set. Source: CoolInterview.com
Answered by: sourav | Date: 6/20/2009
| Contact sourav
Pointer can point to different memory location where array contains contigious memory. Source: CoolInterview.com
Answered by: konica | Date: 7/5/2009
| Contact konica
pointer is use to access the data with its address. and<br>array is the collection of similar data for access and manipulate. Source: CoolInterview.com
Answered by: vaibhav saxena | Date: 7/13/2009
| Contact vaibhav saxena
Actually Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to by them<br><br>Arrays are used to manipulate multiple values of same kind of data without declaring and assigning them individually. The important point to be noted is that while programming, pointer indirections can be achieved by array notations and vice-versa. For example, class[60] is exactly equivalent to *(class+60). This may lead some beginner programmrs to think that pointers and arrays are euivalent, but they are equivalent only to the parser, the programmer need not be concerned about whether they are equivalent or not. Source: CoolInterview.com
Answered by: Swagato Barman Roy | Date: 7/20/2009
| Contact Swagato Barman Roy
By-default the array variablr is const pointer.<br><br>int arr[10];<br><br>where arr is const pointer (i.e. always pointing to fixed address)<br><br>While a pointer can point to any address of it's type. Source: CoolInterview.com
Answered by: Ramakant | Date: 7/22/2009
| Contact Ramakant
Arrays just like normal variables only. They can be effected directly as we modify variables.<br>But pointers are can be modified by modifying their address only Source: CoolInterview.com
Answered by: sanjaykumar | Date: 7/24/2009
| Contact sanjaykumar
ARRAY is a collection of similar data types.<br>Elements of an array occupy adjacent memory location in RAM.<br>For Eg.. <br>int a[5];<br>An integer type array that can store 5 elements is created.<br><br>A POINTER is a special kind of variable that stores the address of other variabes.<br>It is denoted by *<br>For eg.. *ptr Source: CoolInterview.com
Answered by: Ankita Leekha | Date: 7/25/2009
| Contact Ankita Leekha
An array is a structer that can store several elements sequantialy in memory.Array index number start with 0.<br>Pointer is store memory address of another variable.Pointer is declared with * operator. Source: CoolInterview.com
Answered by: Deepak Bankar | Date: 7/30/2009
| Contact Deepak Bankar
arrays:<br>1.array is a constant pointer,which is having base address.<br>2.we will use subcripts to access the<br> array variables<br>pointer:<br>1. pointer is variable address.<br>2. pointer use indirection operator<br> to access array elements<br> Source: CoolInterview.com
Answered by: harsha | Date: 8/2/2009
| Contact harsha
Array is a constant pointer.<br>we con't change base address of array. Source: CoolInterview.com
Answered by: vinod kumar | Date: 8/11/2009
| Contact vinod kumar
In case of passing parameter to the function, pointer holds the address of orginal array and changes will be donein same array.<br><br> but passing array parameter needs a another copy of same size array at calling function and it will not reflect the change to the original array. . Source: CoolInterview.com
Answered by: SAngeeta SAngani | Date: 8/19/2009
| Contact SAngeeta SAngani
A pointer is an address in memory where a variable is located. <br><br>An array is a conceptual data representation consisting of a list of more than one item of a particular scalar type (int, float, char, structure, etc.) where each element is accessed by its index. The index can be thought of as a counter or enumerator telling you how many elements you have to skip over to get to the one you're interested in. Here's where addresses come in ... the location of a particular element in memory is offset from the so-called base address (i.e. the address of the starting element) by the value <br><br>(sizeof(one element) * index #) <br><br>The C compiler is smart enough to take the sizeof() into account when you do pointer arithmetic, so you can find the address of the i-th element as (address of base) + i, rather than having to do the multiplication explicitly. <br><br>The idea of element address as offset also accounts for C's use of zero-relative array definitions. Since the first element is offset by 0 positions from the first element its index in C is 0, not 1. The second (ordinal) element is offset from the first by 1 position so its index is 1, and so on Source: CoolInterview.com
Answered by: jayant gurjar | Date: 8/26/2009
| Contact jayant gurjar
pointers are used to point to storage indirectly through * operator.<br>arrays are used for contiguous storage of data which can be accessed by the starting address of the array.<br>compiler also treats array data using pointers. for ex: if 'a' is an array with subscript 'i' , then ith element is treated as *(a+i) by compiler. Source: CoolInterview.com
Answered by: chaitu | Date: 8/28/2009
| Contact chaitu
An array ar[15][23]is stored inmemory along the column with each of element occupying 8byte. find oyt the base adress and the adress of an element arr[23]21],if the location arr[12]23]is stored at the adress4000. Source: CoolInterview.com
Answered by: haripaloraon | Date: 8/28/2009
| Contact haripaloraon
Array is a collection of same data type. <br><br><br>Pointer is used to refer the address.pointer value refered by &.<br><br> Source: CoolInterview.com
Answered by: shanthi | Date: 8/30/2009
| Contact shanthi
Arrays are basically pointers BUT the difference is that arrays are constant pointers and so we cannot do pointer arithmatic with arrays as we do with other pointers. <br><br>ie; ArrName++ or ArrName-- is not possible in the case of arrays while it is possible for pointers Source: CoolInterview.com
Answered by: Lily Antony | Date: 9/10/2009
| Contact Lily Antony
In actual there is no difference between arrays and pointers.<br>It is only that they are different in manners they are declared and accesed by the programmer.<br>for example <br>int a[3]= {<br> 1,<br> 2,<br> 3<br> }<br>This is same as int *p;<br> *p = 1;<br> *(p+1) = 2;<br> *(p+2) = 3;<br><br>If you want to print 2<br>for the 1st case write<br>printf("%d",a[1]);<br>for the 2nd case write<br>printf("%d",*(p+1)); Source: CoolInterview.com
Answered by: vallari | Date: 9/11/2009
| Contact vallari
Pointer is used to store address of a variable(Variable contains the value).Pointer is denoted by * before a variable.<br>Where as Array is a collection of variable of similar type and it may be of differnt dimentions example array of 1 dimention = ar[],array of 2dimention[][] and so on. Source: CoolInterview.com
Answered by: Sumit | Date: 9/11/2009
| Contact Sumit
The array size depends on the datatype and on the subscipt value.<br>Array representation is very easy to understand <br><br><br>Pointer is always of constant 2 bytes irrespective of the datatype it is pointing to........<br>Pointers occcupy less memory space... Source: CoolInterview.com
Answered by: Subrahmanya | Date: 9/11/2009
| Contact Subrahmanya
The main diff. w/b array and pointer.<br> array is a simler collection of number or char. while pointer is a variabile whish point the memory of the variabile. Source: CoolInterview.com
Answered by: abhishek shukla | Date: 9/28/2009
| Contact abhishek shukla
In Array, each Time, The comiler allocates the memory To maximum Elements or to full size of the array. Suppose If User wants To Use only 5 elements at a time From 20 elements of declared Size of the array. It wastes 15 allocated Location in the Memory,,,,, Pointers Remove This disadvantage , With Malloc, n calloc, Pointers Allocates The desired Memory To the variable or Elements of the array,, Source: CoolInterview.com
Answered by: Rahul | Date: 9/29/2009
| Contact Rahul
Pointer is a variable capable of storing address of another variable.<br><br>Array is a data type which is used to store group of variable of same type Source: CoolInterview.com
Answered by: pratyasini satapathy | Date: 10/5/2009
| Contact pratyasini satapathy
ARRY : Arry is the collection of similar data types.<br>POINTER : Pointer is the variable which stores the value of another varible Source: CoolInterview.com
Answered by: Amol Patil | Date: 10/5/2009
| Contact Amol Patil
POINTER : pointer is a variable dat is used to store an address of any variable in order to call it by adderss.<br>ARRAY: array is a datastructure havin similar datatypes<br><br>NOTE:The name of any array is a pointer. Source: CoolInterview.com
Answered by: pravat kumar sahoo | Date: 10/11/2009
| Contact pravat kumar sahoo
array is group of collection of data of same type <br><br>pointer is to store the reference of another variable Source: CoolInterview.com
Answered by: sridhar | Date: 10/12/2009
| Contact sridhar
pointers are nothing but a memory location which points the desired variable.<br>Array is a contiguas memory location having same data type. Source: CoolInterview.com
Answered by: Harendra kumar | Date: 10/13/2009
| Contact Harendra kumar
pointer: it is an address of a variable<br><br><br><br>array:it is a continuous memory location where similar type of data is stored Source: CoolInterview.com
Answered by: swathi reddy | Date: 10/22/2009
| Contact swathi reddy
Pointer is a variable capable of storing address of another variable.<br><br>Array is a data type which is used to store group of variable of same type <br><br><br> Source: CoolInterview.com
Answered by: gopi | Date: 10/23/2009
| Contact gopi
Pointer is a variable, which stores Address of Another variable. And * operator is used to assess the data within it.<br><br>Whereas Array is group of variables having consecutive allocation of memory ended with NULL of similar data type. Source: CoolInterview.com
Answered by: Basavaraj Hunshal | Date: 10/24/2009
| Contact Basavaraj Hunshal
ARRAY:It is a collection of all data items which can be stored at same location.<br>pointer: pointer is a variable which stores the address of another variable. Source: CoolInterview.com
Answered by: krishnachaitanya | Date: 10/27/2009
| Contact krishnachaitanya
array:array is a collection of data items which can be stored at same location.<br>pointer:pointer is a variable which stores the address of another variable. Source: CoolInterview.com
Answered by: krishnachaitanya | Date: 10/27/2009
| Contact krishnachaitanya
ARRAY:array works as a contaner that contains the variable of same type.<br>POINTERT:It also work as a container that contains the address of another variable. Source: CoolInterview.com
Answered by: Naina Verma | Date: 10/29/2009
| Contact Naina Verma
array and pointers both are used to store but one stores data and the other stores address<br>also its easy to get or delete or search information if we use pointers but in arrays its very difficult and time consuming Source: CoolInterview.com
Answered by: deepa dev | Date: 11/11/2009
| Contact deepa dev
ARRAY:array is a collection of homogeneous data elemens.which are stored in buffer memory location.<br>POINTER:pointer is a variable which holds the address of another variable.it is easy to access the variable addrress and content in our program. Source: CoolInterview.com
Answered by: LAXMAN HONAWAD | Date: 11/21/2009
| Contact LAXMAN HONAWAD
pointer:- it is store the variable address to assign by astrick symbol.<br>array:- data store simultenously in a similar datatype. Source: CoolInterview.com
Answered by: fakir naik | Date: 11/28/2009
| Contact fakir naik
ARRAY IS THE COLLECTION OF SIMLER TYPE OF DATA ITEN <br>POINTER IS A VARIBALE WICH HOLD THE ADDRES OF ANOTHER VARIBALE Source: CoolInterview.com
Answered by: faiz misbah | Date: 12/1/2009
| Contact faiz misbah
Pointer: Pointer is the variable that stores the address of the another variable..<br>Array: Array is used to store the number of values under a same name.. Source: CoolInterview.com
Answered by: Anand T.M | Date: 12/1/2009
| Contact Anand T.M
Arrays: Fixed size length ( compile time)<br>Pointers: Variable size ( run time) Source: CoolInterview.com
Answered by: prakash | Date: 12/3/2009
| Contact prakash
ARRAY:array works as a contaner that contains the variable of same type.<br><br>POINTERT:It also work as a container that contains the address of another variable. Source: CoolInterview.com
Answered by: Rjbalu | Date: 12/17/2009
| Contact Rjbalu
Pointer is used to hold the adress of another variable.Through this address we con print the value of the variable whose address is taken by Pointer through pointer variable.<br>While array is used to store the values of same data type in index form starting from zero because compiler consider it as positive integer Source: CoolInterview.com
Answered by: majid nawaz | Date: 12/28/2009
| Contact majid nawaz
array:is collection of similar datatypes.<br>pointer:is a address memory varible. Source: CoolInterview.com
Answered by: lakshmi | Date: 12/28/2009
| Contact lakshmi
the difference between array and pointer is the array is collection of similar datatypes,pointer is a addres memory variable. Source: CoolInterview.com
Answered by: lakshmi | Date: 12/28/2009
| Contact lakshmi
pointers can be allocate the memory at run time i.e the size of the variable can be allocate at run time but arrays didnt done that. Source: CoolInterview.com
Answered by: sadhana | Date: 1/15/2010
| Contact sadhana
Pointer: Pointer is a variable,which can be store an address of same datatype variable.<br><br>Array: Array is a collection of same datatype variables.It is taken the memory as sequential. Source: CoolInterview.com
Answered by: AAYUSH MITTAL | Date: 1/21/2010
| Contact AAYUSH MITTAL
Pointer or Array name, both store memory address of other location. Array name and Pointer vsrible names can be interchangably used for each other. Only difference is Ptr++ is a valid statement but arr++ is not. In other words, array name is compiler se pointer and can not be moved with arr++. While user declared pointer can be moved Ptr++. Source: CoolInterview.com
Answered by: Vijay Tank | Date: 1/28/2010
| Contact Vijay Tank
array's decompose into pointers..<br>An array is nothing but a implicit pointer.<br> int a[5]; the compiler converts this as int *const a; As the address can not be altered.<br>int b[3] , then a=b ; not posible, Mr Denise Ritche made it so there is no memory leak. Source: CoolInterview.com
Answered by: mahanth hiremath | Date: 1/29/2010
| Contact mahanth hiremath
Pointer is a variable which holds the address of another variable where as An ARRAY is a set of similar data items stored simultaneously. Source: CoolInterview.com
Answered by: S.Ramesh | Date: 1/30/2010
| Contact S.Ramesh
Pointer is use to access the data with its address. and array is the collection of similar data for access and manipulate. Source: CoolInterview.com
Answered by: deepak chaudhary | Date: 2/5/2010
| Contact deepak chaudhary
array is collection of hemogenius datatypes but pointer is a memory variable used to access the address of the another variable.through pointer we can access the values of the variale.<br>declaration of an array:<br>datatype variablename[size];<br>pointer declaration:<br>datatype *pointer variable name;<br>*-represents the dereferencing operator Source: CoolInterview.com
Answered by: k.ganeshwari | Date: 2/10/2010
| Contact k.ganeshwari
pointer is used to address of the memory location.syntax:datatype *pointer variable;<br>array is a homogenous datatype.syntax:datatype variable<row size><column size> Source: CoolInterview.com
Answered by: remeena.v | Date: 2/10/2010
| Contact remeena.v
pointers are used to poinnt to th eaddress of another variable.but in array we can store more elements using same array name.<br>for eg:student[10].int this u can store 10 students using one array name student. Source: CoolInterview.com
Answered by: vijayalakshmi | Date: 2/24/2010
| Contact vijayalakshmi
Pointers are basically address variables...which can be assigned memory dynamically through malloc and calloc to store any data....while array is a statically allocated memory space in a contigeous format of group of identical data-members.. Source: CoolInterview.com
Answered by: Pinki Ruparel | Date: 3/4/2010
| Contact Pinki Ruparel
POINTERS:<br> *POINTER IS THE VARIABLE IT HOLDS THE ADDRESS OF ANOTHER VARIABLE<br> *ARRAY HAVING THE COLLECTION OF SIMILAR DATA TYPE.<br> *WE DIDN'T PASS THE ARRAY AS ARGUMENT.<br> * BUT WE CAN PASS THE POINTER AS ARGUMENT. Source: CoolInterview.com
Answered by: anjana priyadharshini | Date: 3/6/2010
| Contact anjana priyadharshini
array is an implicit pointer.which stores the address of first value in the array.this follows contiguous memory allocation. where as pointer also stores the address of the another variable.nested pointers also exist. Source: CoolInterview.com
Answered by: rani | Date: 3/12/2010
| Contact rani
array is continuous allocation of similar data types...you cannot change allocation address in an array<br>where a *(pointer) stands for value at address.<br>int *a means value at the address a is of type integer. Source: CoolInterview.com
Answered by: matang | Date: 3/23/2010
| Contact matang
array:array is a collection of same data type.<br>pointer:it can store an address of same data type variable Source: CoolInterview.com
Answered by: revathi | Date: 3/30/2010
| Contact revathi
POINTER IS A VARIABLE WHICH CONATAINS THE ADDRESS OF ANOTHER VARIABLE. ARRAY IS COLLECTION OF SIMILAR DATA TYPES AND INDEX START WITH 0 ONLY Source: CoolInterview.com
Answered by: SRINIVAS | Date: 4/7/2010
| Contact SRINIVAS
pointer is a variable that holds the address of another variable. array is a coolection of elements Source: CoolInterview.com
Answered by: pooja | Date: 4/7/2010
| Contact pooja
ARRAY:-<br>Array is the collection of similar type of data.It's syntax is<br> data type varibl name[];<br>POINTER:-<br>It's holds the address of another variable.It's syntax is<br> *p.<br> Source: CoolInterview.com
Answered by: kishor | Date: 5/18/2010
| Contact kishor
basically pointer is used to create dynamically memory allocation so its really help from wetage of memory.where as array is fixed size of memory allocation so it may some time waste memory so this is major differece between array & pointer Source: CoolInterview.com
Answered by: ronak mistry | Date: 5/25/2010
| Contact ronak mistry
Arrays are just the collection of similar items and pointers are the address to the functions Source: CoolInterview.com
Answered by: venkat ANR College | Date: 6/1/2010
| Contact venkat ANR College
Pointer is an variable which stores the address of another variable<br>An array is a collection of similar data types it stores in contiguios memory location... Source: CoolInterview.com
Answered by: ankur chourasia | Date: 6/3/2010
| Contact ankur chourasia
pointers is an adress in memory where the varible is located.<br>Arrays is stored conitnuos memory allocation and used subscripted variables. Source: CoolInterview.com
Answered by: swathisrikar | Date: 6/6/2010
| Contact swathisrikar
array is a collection of similar data types. pointer is a container contains the address of another variable. the concept is different allocating memory. Source: CoolInterview.com
Answered by: vishal | Date: 6/8/2010
| Contact vishal
(1)pointer can be increment and decrement but the array can not be incremeted and decremented.<br>(2)array can not be pass by value whenever the array are always pass by referance Source: CoolInterview.com
Answered by: kamal thakur | Date: 6/11/2010
| Contact kamal thakur
The most important thing is that, even compiler compiler manipulate arrays in pointer forms only. Array is a constant pointer and address can't be chnaged once declared, while pointer can be re-assigned any number of times. Arrays are easy to use and manipulate, while pointers are tough to use if you are familiar with them. Array doesn't take any additional memory space while pointer takes. Post/pre increment/decrement is possible for pointer while not in arrays. Source: CoolInterview.com
Answered by: Devendra Bhadoriya | Date: 6/20/2010
| Contact Devendra Bhadoriya
Pointers are variables stored in non-linear manner whereas array is a data structure in which elements are stored in linear manner. Source: CoolInterview.com
Answered by: vipul arora | Date: 6/25/2010
| Contact vipul arora
1.array is a collection of similar data type.<br>2.Array has fixed size.<br>3. Pointer holds the address of any type variable.<br>we can point an array by ponier variable Source: CoolInterview.com
Answered by: Gowri | Date: 6/28/2010
| Contact Gowri
Pointers are used to manipulate data by using address or they are address variable used to store address.Pointers use * operator to access data.1)pointer can be increment and decrement but the array can not be incremeted and decremented.Pointers are variables stored in non-linear manner whereas array is a data structure in which elements are stored in linear manner.
Source: CoolInterview.com
Answered by: Md. Sajid khan | Date: 8/21/2010
| Contact Md. Sajid khan
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|