Home > Back-end >  The error C2109: subscript requires an array or pointer type error bosses do o solve
The error C2109: subscript requires an array or pointer type error bosses do o solve

Time:09-25

#include
#include
Void main (void)
{
Char A1 [100]={0};
Char A2 [100]={0};
int i;
Printf (" please input an arbitrary string \ n \ r ");
The scanf (" % s ", & amp; A1);
Memcpy (A2, A1, sizeof (A1)/sizeof (char));
for(i=0; i<100; I++)
Printf (" A [% d]=% s \ n \ r ", I, A [I]);


}




Beginner C, ask everybody to help solve the problem of error, thank you!

CodePudding user response:

 # include & lt; Stdio. H> 
#include
//void main (void)
Int main (void)
{
Char A1 [100]={0};
Char A2 [100]={0};
int i;
Printf (" please input an arbitrary string \ n \ r ");
//the scanf (" % s ", & amp; A1);
The scanf (" % s ", A1);
Memcpy (A2, A1, sizeof (A1)/sizeof (char));
for(i=0; i<100; I++)
//printf (" A [% d]=% s \ n \ r ", I, A [I]);
Printf (" A [% d]=% c \ n \ r ", I, A2 [I]);


}

For your reference ~
  • Related