Function problems in the C language, please help the masters, urgent!

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

    int i,j,n;

    for(i=0,j=0;i<10;,j++,i++)if(a[i]%2==0)

    a[j]=a[i];

    n++;return(n);

    Your first subfunction is missing a void in front of it

    int i,j;

    for(i=0,j=0;s[i]!='\0';i++,j++)if(s[i]!=a)

    s[j]=s[i];}

    s[j]='\0';

    You run it! Generally right!

  2. Anonymous users2024-02-06

    The hand is born, just write some ideas:

    1. Data structure. A and B are struct arrays, and each array element is a struct, including student ID, name, and other information.

    2. Input and output. Use the fscanf function to read the value of one struct element at a time from the file, loop to the end of the file, and an array is assigned. Similarly, use the fprintf function to output an array of elements to the file one at a time, and loop until all of them are output.

    3. Delete the same student number element. For the student number of each element in a, iterate through the b array, compare the student number, and as long as it is the same, modify the student number of that element in a to a special value. And then the next one.

    After checking all of them, delete the element with the secondary school number A as a special value. Think for yourself about this algorithm.

    Fourth, subfunction calls. Read the file and write a subfunction to assign values to the array. Output an array to the file and write one as well.

    Given an array element, go to the b array to see if there is anything like his student number, and write one. Finally, delete the detected element from the A array and write one.

    What is said is not necessarily right, for your reference.

  3. Anonymous users2024-02-05

    Can you send the file and have a look? It is important to know how your student's student number and name are saved.

  4. Anonymous users2024-02-04

    1. Not 3, the maximum legal subscript of the first dimension of the two-dimensional array a is 2, because a[0][

    Therefore, the maximum legal subscript for A is A[2][3];

    2. Because i starts from 1 and ends less than 3, the value of i is ;

    When i=1, j is reduced from i (i.e., 1) to 0, that is, the value of j is , and at this time, it is: a[1][1]+a[1][0] are added;

    When i=2, j is reduced from i (i.e., 2) to 0, that is, j takes the value of , which is: a[2][2]+a[2][1]+a[2][0].

    In summary: s=a[1][1]+a[1][0]+a[2][2]+a[2][1]+a[2][0]=4+3+0+6+5=18;

    Note: a = 1 2 0

    3. The macro definition is: specifying what something represents.

    Take "define a 2" as an example, as long as a is encountered in the program in the future, it represents the number 2, that is, you can replace a with 2.

    Please explain the problem in your question in order to give you the result of this question:

    printf("%d",2*(a+(b+c)) The capital letter c does not indicate that it is a description, please check the program again.

    And there is" #define b (c)((a+1)*c) "Why are the two parentheses in the question so far away, it should be a multiplicative relationship.

  5. Anonymous users2024-02-03

    Question addendum: How to do it exactly? There's no syntax error here, it's just that when executed, the assigned ram includes

  6. Anonymous users2024-02-02

    The value can be any positive integer greater than 3, as long as your memory is large enough, and the rest is initialized to 0. As for the case less than 3, an error will be reported during compilation, and the compiler does not allow the array to be out of bounds.

    A good explanation is that the second dimension of 3 does not show initialization, and everything that is initialized is initialized to 03A macro is a drop-in replacement.

    The macro definition b is a macro with arguments, and there is a a in the substitution that I don't understand, how b and b() are the same thing when using b.

    The above ** I don't know what to do definitely can't be compiled.

Related questions
13 answers2024-04-04

1) This prompt appears in the lower right corner of the taskbar (a file is damaged, please run to use the chkdsk tool to repair), it is generally caused by too many junk files in the system, mainly the junk files generated by the Internet, just clean it up. >>>More

6 answers2024-04-04

I majored in computer science, and I was embarrassed when I first learned C language, but I also had some experience. >>>More

8 answers2024-04-04

You can use function pointers, such as:

voidfunction(int >>>More

7 answers2024-04-04

Reply to your questions one by one first:

1. It can be supported, but it is very troublesome. In addition, Turbo C is both an integrated development environment (IDE) and a compiler. The device is just the same thing as a notepad. >>>More

9 answers2024-04-04

Scope. You static char *chh;

static char *ch1;Although the address pointed to by the two pointers does not change, have you ever wondered whether the memory address they point to has been released, char chc[10]; It's local, the function is out, the lifecycle is over, and you're trying to access it with a pointer in void times(). >>>More