Getting Started

(lily) #1

Chapter 8: C Pointers and Arrays


confuseus + 1); = ");

howdy[] = {'h','o','w','d','y','\0'};

i]; // c1 = 'y' using array notation
sendString("c1 = howdy[i]; = ");

confuseusmore = &howdy[i]; // confuseusmore points to 'y'
i]; = );

ts to 'd'
sendChar(*confuseusmore);

sendString("c1 = *(
sendChar(c1);
sendChar('\r');


c2 = confuseus + 1;
sendString("c2 =
confuseus + 1; = ");
sendChar(c2);
sendChar('\r');


}


void Confuseusmore()
{
char
int i = 4;
char c1,c2;
char* confuseusmore;


sendString("\rIn Confuseusmore()\r");


c1 = howdy[


sendChar(c1);
sendChar('\r');
c2 = (howdy + 4); // c2 = 'y' using pointer notation
sendString("c2 =
(howdy + 4); = ");
sendChar(c2);
sendChar('\r');


sendString("confuseusmore = &howdy[ "
sendChar(*confuseusmore);
sendChar('\r');


confuseusmore = howdy + i - 1; // confuseusmore poin
sendString("confuseusmore = howdy + i - 1; = ");


sendChar('\r');


}

Free download pdf