C Interesting Array initialization

Source: Internet
Author: User

C Interesting Array initialization

  1. #include <stdio. h>
  2. int main()
  3. {
  4. int I = 0;
  5. Char a[1024x768];
  6. Char A0[ten] = {};
  7. Char A1[ten] = {1};
  8. Char A2[ten] = {1,};
  9. Char A3[ten] = {1, 1};
  10. for(i=0; I< 1024x768; I++){
  11. printf("%u", a[i]);
  12. A[i] = (i*i)%11;
  13. }
  14. printf("\ n------\ n");
  15. for(i=0; I<; I++){
  16. printf("%u | %u | %u%u\n ", A0[i], A1[i], A2[i], A3[i]);
  17. }
  18. printf("\ n");
  19. }

Results

    1. 0000000042949672804
    2. ------
    3. 0 | 1 | 1 1
    4. 0 | 0 | 0 1
    5. 0 | 0 | 0 0
    6. 0 | 0 | 0 0
    7. 0 | 0 | 0 0
    8. 0 | 0 | 0 0
    9. 0 | 0 | 0 0
    10. 0 | 0 | 0 0
    11. 0 | 0 | 0 0
    12. 0 | 0 | 0 0

Run the first time and this may not be the same, from the second time after the same.

1, a[10]; Just make a label, do not allocate memory, to a[0]= (1*1)%11 when allocating memory, but in the data section of the stack to find an address assigned to a, do not initialize;
2,a? , initialization 0 is done, and the given value is assigned to the specified position in A123.
3, the highlight is a0={} of the writing, I first try to, estimate this compiler related.

C Interesting Array initialization

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.