Home > Back-end >  For array and structure assignment
For array and structure assignment

Time:11-06

Structure can be conducted through the structure assignment, the array can not, but is can contain an array structure, so structure assignment is contains the array in the body of the structure under assignment, in that case, why now C doesn't allow through the array of array assignment, who can know the reason?

CodePudding user response:

 
Struct book {
Char name [10].
Char auther [10].
A float value.
};
Struct book math;
Math=(stuck book) {" studymath ", "John", 45.3};

CodePudding user response:

Oh, yes, with defined array assigned to a new number

CodePudding user response:

Oh, yes, with the defined array assignment to the new array

CodePudding user response:

reference 3 floor space to the breeze full building response:
oh, yes, assigned to a new array with the defined array

 # include & lt; stdio.h> 

Int main ()
{
Char a []="abcdefg";
Char b [10];
B=a;
Printf (" % s \ n ", b);
return 0;
}

The compiler cannot through;
And you through the following:
 # include & lt; stdio.h> 
#include

Int main ()
{
Char a []="abcdefg";
Char b [10];
for (int i=0; iB=[I] a [I];
Printf (" % s \ n ", b);
return 0;
}

CodePudding user response:

Array variable, array name actually says is constant address, so b=a; Is equivalent to a address assigned to b, but b address is constant, so can't assignment
Said structure variable name isn't constant address? Don't understand
  • Related