C-language arrays do function parameters degenerate into pointers

Source: Internet
Author: User

My system is Mac OS 64 bit. There are differences depending on the number of system bits that you have. Here are some of the problems I encountered during my studies

Heroes Skip ...

Sometimes we want to manipulate the elements of an array by a function, and in the Sizelen function think of the length of the arrays by sizeof.

The idea is good, don't think you know the C language very well. In fact the array in the function parameter is just passed, a pointer. That is, the array

's first address.

As you can see from the results, the C compiler did exactly that. My system is 64 bits, so int * is accounted for 8 bytes.

These are just the problems I encountered during my study. Heroes Skip ...

C-language arrays do function parameters degenerate into pointers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.