A C foundation question, a question about C

Updated on educate 2024-04-13
7 answers
  1. Anonymous users2024-02-07

    I think lz just wants to print out the address of a and the address of a+1 Here, a is the starting address of the array, so &a takes the address with a as a variable, that is, the address that stores the address of the array, but if (a+1) is addressed, it is not right, because (a+1) is not a defined variable here, but the value of a temporary variable, it is only equal to the value of the next address of the starting address of the array, not a variable that stores the value, and it is not right to take the address.

    I don't know if I've made it clear

    To add: if (a+1) is assigned to variable b first, i.e. int b=int(a+1); , it is possible to take the value of b again, i.e.

    int b=int(a+1);

    Cout "That's it!

  2. Anonymous users2024-02-06

    It is an address, and A is already an address, so you can't address A or A+1.

    To get the right result, you can't cout < first

    There is also the main() function that must return the int value, which should be int main().

  3. Anonymous users2024-02-05

    cout should be written if you want to output a[0], a[1].

    cout<<*a<<" "<<*a+1);

    Instead of cout<

  4. Anonymous users2024-02-04

    Cout "There is a big problem with the above sentence.

    cout "The latter also wants to print the address, which doesn't make any sense.

    The address of A is A, and it is the same with or without &.

    There is no place to save (a+1) in memory, so &(a+1) is of course incorrect.

  5. Anonymous users2024-02-03

    a[1] is the address of the second element, not a+1

  6. Anonymous users2024-02-02

    1.Standard C++ requires that main have an int return value, and that int main() corresponds to return 0;Although the C++ standard does not allow main to be void, some compilers such as vc6 allow main to be void, and the header file is declared to include (in C++. H's header file is support for C, making it non-templated) It's better to learn C++ or write int main().

    Many compilers ignore whether the main function is declared void or not. Earlier C functions were of type int by default, and did not detect whether undeclared functions returned data. In C++, in order to achieve consistency of description, all functions must declare types, and the custom of C is used for untyped declarations, but a return value is required for int types, otherwise a warning will be raised.

    2.If the logic is correct, it shouldn't make a difference.

    3.Encapsulation is all about hiding the details, and the customer just needs to know how to use it, regardless of how the function is implemented.

  7. Anonymous users2024-02-01

    I don't know what you mean by **?

Related questions
8 answers2024-04-13

It's nonsense to say so much above. Landlord please see: pay attention to your program: printf("%d,%d",(a,b),(b,a); >>>More

9 answers2024-04-13

If you try Norton Partition Magic, you'll see it clear and easy to use, so you can do whatever you want.

6 answers2024-04-13

The p of both is a pointer.

p=&t, change the content that p points to to the address of t, and p=&t is the address that changes the pointer to t. >>>More

5 answers2024-04-13

The above method needs to calculate the factor twice, the complexity increases, you can use the array to store the factor, the complete program is as follows. >>>More

11 answers2024-04-13

In a situation where there is no gravity, the water of tap water can also flow out, which is the same as human blood, it flows in the human body, once there is a wound, then due to the compression of the heart, the blood will be squeezed out of the body! >>>More