C Programming - Arrays - Discussion
Discussion Forum : Arrays - Yes / No Questions (Q.No. 1)
1.
A pointer to a block of memory is effectively same as an array
Answer: Option
Explanation:
Yes, It is possible to allocate a block of memory (of arbitrary size) at run-time, using the standard library's malloc function, and treat it as an array.
Discussion:
7 comments Page 1 of 1.
Pooja chaurasia said:
1 decade ago
Can anyone explain it?
Dilini said:
1 decade ago
Can anyone submit a program of allocating a block of memory (of arbitrary size) at run time by using malloc function.
Anil said:
1 decade ago
int *p= (int*)malloc(n*sizeof (int));
But the answer is B. Because in arrays it is not possible to change the base address. But we can change here.
But the answer is B. Because in arrays it is not possible to change the base address. But we can change here.
Abhishek said:
1 decade ago
Structure type variables are also block of memory, which is not the same as array. Can anyone explain this?
Dickby said:
9 years ago
As I know it does not have the same behavior as an array.
Try sizeof on an array and on a pointer. Can somebody explain why false is the wrong answer?
Try sizeof on an array and on a pointer. Can somebody explain why false is the wrong answer?
Vaishu said:
7 years ago
Can anyone please explain in detail?
Sonu said:
4 years ago
Arrays have the same behaviour like a pointer.
Because pointer refers to address of next data similar as an array.
Because pointer refers to address of next data similar as an array.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers