-
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
-
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.
-
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!
-
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
-
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.
-
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.
-
All variables involved must be declared in advance, otherwise they will be invalid.
-
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.
-
Yes, variables must be defined before they can be used in C.
-
Ibid., but I don't understand if it's a problem.
-
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( )?"
-
What is this?,It's so messy.。。。
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
C language in computer software (Windows platform) programming.
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
Define an array of scores to record scores, record rankings and score bins. >>>More
The reason why the exe stops working when the C program runs is because of a memory overflow and a compiler error. >>>More