C programs require analysis, not just answers, thank you

Updated on technology 2024-04-06
12 answers
  1. Anonymous users2024-02-07

    sub1() executes:

    for(i=0;i, so the value of each member of the array a is:

    a[0]:0+0=0

    a[1]:1+1=2

    a[2]:2+2=4

    a[9]:9+9=18

    sub3(a)

    Pass the first address of the global array a to int a, in fact, a here is a pointer pointing to the first address of array a, and then perform a numerical traversal through the pointer in sub3 to output the value of each member:

    sub2();

    Note here that this function operates on the value of its internal temporary variable a[max], and has no effect on the global quantity a[max].

    sub3(a)

    Pass the first address of the global array a to int a, in fact, a here is a pointer pointing to the first address of array a, and then perform a numerical traversal through the pointer in sub3 to output the value of each member:

    So the result is b

  2. Anonymous users2024-02-06

    I don't think the answer is either, I think it is

    Let me tell you what I think, first of all, let me tell you, this program is a little problem, the main function, there should be sub1, sub2, sub3 3 functions in front of it, otherwise the main function can't be called, or put the main function at the end, this is a little problem with this program, and then I'll take you to the main function to the side, the definition of max and the sequence a, you should understand, I won't say it, the main function "n" wraps, run sub1, run sub1 The sequence a has been assigned all the values Now a[max]= Then it's time to run sub3(a) to output the sequence a is 0 2 4 6 8 10 12 14 16 18 Then run sub2 sub2 is to assign the first 5 elements of the sequence a 0 1 2 3 4 the other elements remain unchanged and then run sub3(a) to output the modified sequence a

    So I think the answer should be.

  3. Anonymous users2024-02-05

    a[max] in sub2 is a newly defined array in the program, which is different from the original one (which is a globally variable array). When the program is called and no value is returned, the a[max] in sub2 does not affect another array of global variables.

    So the value of the global variable array a[max] doesn't change!

  4. Anonymous users2024-02-04

    Output

    This triangle has an area of 6If abc is changed to 1, the output is 0The problem is that all variables are integers, and the results of integer mutual operations must also be integers, and the p-value result is incorrect

    Because of the judgment of whether the ABC input is reasonable, such as the ABC value should be 0, the variable-length ABC value should be able to form a triangle, and meet the condition of the third side of the sum of any two sides

  5. Anonymous users2024-02-03

    The variables defined in the program must be in front of the place where they are used, otherwise errors will occur. It's a good idea to have the global variables defined at the top, which is convenient.

  6. Anonymous users2024-02-02

    C language occupies the memory of the system, especially pointers (pointing to addresses in memory), if not predefined, it may cause the system to crash, other variables, arrays or whatnot, must also be defined first and then assigned, otherwise it cannot be used, if not explained first, the system will prompt an error during compilation.

  7. Anonymous users2024-02-01

    All variables involved must be declared in advance, otherwise they will be invalid.

  8. Anonymous users2024-01-31

    1. C language stipulates that all variables used in the source program must be explained first and then used, otherwise errors will occur. (

    2. C programs always start with the first function in the file. (3. Both integer arrays and character arrays can be input and output as a whole. (4) Variables with the same name can be used in different functions in a source program file.

    5. The pointer of the function refers to the address of the memory unit occupied by the return value of the function. ( 1, right;

    2. Wrong, it is executed from the main main function.

    3. Wrong, the integers must be input and output one by one.

    4. Yes, this question tests the content of the scope.

    5. Yes, this is the basic concept of function pointers.

  9. Anonymous users2024-01-30

    Yes, variables must be defined before they can be used in C.

  10. Anonymous users2024-01-29

    Ibid., but I don't understand if it's a problem.

  11. Anonymous users2024-01-28

    After testing, this program does not work at all. There are many grammatical errors that are very grammatically obvious. For example: "How can there be an underscore in the brackets of main( )?"

  12. Anonymous users2024-01-27

    What is this?,It's so messy.。。。

Related questions
7 answers2024-04-06

In the whole main function, only this one variable, whether it is the first for or the second for, is the same i, the second for will have i=-1, in the case of i= -1, and printf("%d ",a[i]);Statement. So fear not! When there is no second for the case: >>>More

19 answers2024-04-06

C language in computer software (Windows platform) programming.

8 answers2024-04-06

If the landlord is looking for the textbook for the class, it is not helping the landlord, the book is not good, and no one has to do the electronic version. >>>More

5 answers2024-04-06

Define an array of scores to record scores, record rankings and score bins. >>>More

3 answers2024-04-06

The reason why the exe stops working when the C program runs is because of a memory overflow and a compiler error. >>>More