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


Please Help Members By Posting Answers For Below Questions

Write a code of a general series where the next element is the sum of last k terms.

843


How to delete a node from linked list w/o using collectons?

2428


What is the use of putchar function?

861


what type of questions arrive in interview over c programming?

1805


Is swift based on c?

890


What is structure data type in c?

786


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

820


What is the difference between malloc calloc and realloc in c?

921


What will be your course of action for a push operation?

885


How do I create a directory? How do I remove a directory (and its contents)?

892


To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9

2465


Explain what does it mean when a pointer is used in an if statement?

858


What are the 4 types of programming language?

810


Write programs for String Reversal & Palindrome check

826


In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.

2914