Home > Back-end >  C language array
C language array

Time:09-25

 
#include

Void main ()
{
A char (*) [6]="world";
Char * b=a;
Printf (" % c ", a);
Printf (" % c ", * * a);
Printf (" % c ", * b);
Printf (" % c ", * (a + 2));
Printf (" % c ", * (b + 2));
If (a==* a) printf (" yes ");
The else printf (" no ");
If (a==b) printf (" Y ");
The else printf (" N ");
System (" pause ");
}


Which explain the origin of the great god, really don't understand

CodePudding user response:

The building Lord determine program can compile? What version of the compiler?

CodePudding user response:

reference 1st floor ooolinux response:
can be compiled by the landlord to determine program? What version of the compiler?

Vs2010... ...

CodePudding user response:

Save as CPP cannot pass, save as c format warn a lot of, this program does not make sense,
Under my understanding:
Suppose you have a char c [6]="world"
A char (*) [6]=c//so * a==c is equal to the first address a==character array & amp; C value or is equal to the first address character array, and so * a==a
Char * b===a//so b is equal to a character array first address
Printf (" % c ", a);//in c % format output first address meaningless
Printf (" % c ", * * a);//output c [0]=='w'
Printf (" % c ", * b);//output c [0]=='w'
Printf (" % c ", * (a + 2));//a + 2==c + 2 * 6==c + 12, * (a + 2) is unknown meaningless
Printf (" % c ", * (b + 2));//output c [2]=='r'
If (a==* a) printf (" yes ");//output yes
If (a==b) printf (" Y ");//output Y
  • Related