What is the real difference between arrays and pointers?

Answers were Sorted based on User's Feedback



What is the real difference between arrays and pointers?..

Answer / guest

Arrays automatically allocate space which is fixed in size and
location; pointers are dynamic.

Is This Answer Correct ?    202 Yes 25 No

What is the real difference between arrays and pointers?..

Answer / santosh

array is refered directly to the elements.
but in pointers we refers to address of the elements but not
elements . indirect calling of the elements.

Is This Answer Correct ?    155 Yes 26 No

What is the real difference between arrays and pointers?..

Answer / pravinash

array is collection of similar datatype. it is a static
memory allocation means we can not increment and decrement
the arry size once we allocated. and we can not increment
the base address, reassign address.

pointer is a dynamic memory allocation. we can allocate the
size as we want, assigning into another variable and base
address incrementation is allowed.

Is This Answer Correct ?    72 Yes 9 No

What is the real difference between arrays and pointers?..

Answer / 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

What is the real difference between arrays and pointers?..

Answer / pushpanjali panda

Arrays automatically allocate space, but can't be relocated
or resized. Pointers must be explicitly assigned to point
to allocated space (perhaps using malloc), but can be
reassigned (i.e. pointed at different objects) at will, and
have many other uses besides serving as the base of blocks
of memory.

Is This Answer Correct ?    56 Yes 9 No

What is the real difference between arrays and pointers?..

Answer / siddhartha

Arrays allocate the memory space which cannot resized or
reassigned. But in case of pointers the memory size can be
resized

Is This Answer Correct ?    42 Yes 8 No

What is the real difference between arrays and pointers?..

Answer / tapan

Array is slow compare to pointer

Is This Answer Correct ?    46 Yes 16 No

What is the real difference between arrays and pointers?..

Answer / swetha.j.n

Array is a group of elements.But pointer is not a group of
elements.
Array refer to the data in memory location.But pointer
refer to the address in memory location.

Is This Answer Correct ?    21 Yes 2 No

What is the real difference between arrays and pointers?..

Answer / rag

ARRAYS are allocated at compile time.
POINTERS are alocated at run time.
USE POINTERS FOR PROGRAM EFFICIENCY,BECAUSE MEMORY IS
PRECIOUS ONE. So to reduce memory use pointers.

Is This Answer Correct ?    16 Yes 3 No

What is the real difference between arrays and pointers?..

Answer / sankar s

array refer data in memory location , pointer refer address
to the memory location ,pointer refer the pointee
int *a;
int b[10];
a=&b;
where a is the pointer array b is pointee which point out
the starting memory location of an array.

Is This Answer Correct ?    24 Yes 13 No

Post New Answer

More C Interview Questions

while initialization of two dimensional arrays we can initialize like a[][2] but why not a[2][] is there any reason behind this?

4 Answers   Aptech,


what is op? for(c=0;c=1000;c++) printf("%c",c);

21 Answers   Trigent,


Explain what is a 'locale'?

0 Answers  


How can I insert or delete a line (or record) in the middle of a file?

0 Answers  


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

0 Answers   TCS,






What do you mean by a local block?

0 Answers   InterGraph,


#include<stdio.h> #include<conio.h> void main() {clrscr(); char another='y'; int num; for(;another=='y';) { printf("Enter a number"); scanf("%d",&num); printf("squre of %d is %d",num,num*num); printf("\nwant to enter another number y/n"); scanf("%c",&another); } getch(); } the above code runs only one time.on entering 'y' the screen disappeares.what can i do?

3 Answers  


wat is output of the following int main() { const int j=2; int i; switch(i) { case 1:break; case j:break; default:break; } }

2 Answers  


Write an interactive c program that will encode or decode a line of text. To encode a line of text, proceed as follows: Convert each character, including blank spaces, to its ASCII equivalent. Generate a positive random integer. Add this integer to the ASCII equivalent of each character. The same random integer will be used for the entire line of text. Suppose that N1 represents the lowest permissible value in the ASCII code, and N2 represents the highest permissible value. If the number obtained in step 2 above exceeds N2, then subtract the largest possible multiple of N2 from this number, and add the remainder to N1. Hence the encoded number will always fall between N1 and N2, and will therefore always represent some ASCII character. Display the characters that correspond to the encoded ASCII values. The procedure is reversed when decoding a line of text. Be certain, however, that the same random number is used in decoding as was used in encoding.

1 Answers   Amazon, CSJM, HCL, Microsoft, TCS, Wipro,


code for replace tabs with equivalent number of blanks

0 Answers   Bosch,


Can you think of a way when a program crashed before reaching main? If yes how?

2 Answers  


Function calling procedures? and their differences? Why should one go for Call by Reference?

0 Answers   ADP,


Categories