In C are arrays pointers or used as pointers

0 votes
First, look at this code

When this is run, it gives the below result

(The pointers are 8 bytes long because I am running 64 bit architecture)

From my knowledge, I always thought that arrays are simple pointers to a sequence of values stored in memory and when declare some array, you are creating a pointer and allocating space for the sequence it is pointing to.

In my code, if "y" is the constant pointer, why do it got size of 20?Is the variable y replaced by memory address during compilation time or what happens? Anyone knows about this much better?
Aug 11, 2022 in C++ by krishna
• 2,820 points
541 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In C++

0 votes
0 answers

Why are exceptions so rarely used in C++

I've been writing in C++ on and ...READ MORE

Jun 29, 2022 in C++ by Damon
• 4,960 points
333 views
0 votes
1 answer

Are virtual functions the only way to achieve Runtime Polymorphism in C++?

fprintf is a polymorphism function in the C programming language. It can print to a file, stdout, a printer, a socket, or whatever else the system can represent as a stream if you supply it different handles. FILE* file = fopen("output.txt", "w"); ...READ MORE

answered Jun 21, 2022 in C++ by Damon
• 4,960 points
489 views
0 votes
1 answer

how could I use the power function in c/c++ without pow(), functions, or recursion

It is part of a series.  Replace pow() with the previous iteration's value. There is no need for code to call pow ().  Pow(x, 5 * I - 1) and pow(-1, I - 1) may be formed since both have an int exponent dependent on the iterator I from the previous loop iteration. Example: Let f(x, i) = pow(x, 5 * i ...READ MORE

answered Jun 21, 2022 in C++ by Damon
• 4,960 points
2,531 views
0 votes
1 answer

Is 'If Else' statement indentation important or not in C++? [duplicate]

White space has no effect on the understanding of code in C and C++.  That is not to say that the programmer should be unconcerned about its misuse. The easiest method to demonstrate what the above code truly represents is to specify all of the inferred braces directly, as seen below.  The 'if then' or 'otherwise' clause only affects one line of code in the if statement with no brackets. This is one of the reasons why people strive to insist on 'proper coding standards' to guarantee that other people can clearly grasp the programmer's flow and meaning. while(c != cols) { ...READ MORE

answered Jun 27, 2022 in C++ by Damon
• 4,960 points
567 views
0 votes
0 answers

what is containership or nesting in C++?

According to what I believed, a class ...READ MORE

Jul 11, 2022 in C++ by Nicholas
• 7,760 points
380 views
0 votes
0 answers

How member functions are implemented in C++?

I read somewhere that member functions in C++ are similar to regular functions but with an additional implicit this parameter. As a result, I assumed that this software would be unable to discriminate between two functions.  However, the software executed successfully.  So, was the above statement incorrect? #include <iostream> class MyCls { ...READ MORE

Jul 22, 2022 in C++ by Nicholas
• 7,760 points
319 views
0 votes
0 answers

Simple C++ swap function

Why is it that if I have a method like this to swap two numbers, it doesn't work[swap], (I know I can accomplish this by defining pointers in the prototype and then passing the addresses of the relevant variables in main()), yet it works for arrays without having to supply pointers and addresses? It does not work. void num_exchange(int m, int n); int main(){ int num1 ...READ MORE

Jul 27, 2022 in C++ by Nicholas
• 7,760 points
459 views
0 votes
1 answer

Passing a 2D array to a C++ function

There are three ways to pass a ...READ MORE

answered Aug 2, 2022 in C++ by Damon
• 4,960 points
30,543 views
0 votes
1 answer

How do I create an array of pointers?

Student** db = new Student*[5]; // To allocate ...READ MORE

answered Aug 5, 2022 in C++ by Damon
• 4,960 points
982 views
0 votes
0 answers

How to make an array with a dynamic size? General usage of dynamic arrays (maybe pointers too)?

I wanna create a program that can ...READ MORE

Aug 5, 2022 in C++ by krishna
• 2,820 points
970 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP