26.07.2013 Views

Passagem de Parâmetros e Estruturas

Passagem de Parâmetros e Estruturas

Passagem de Parâmetros e Estruturas

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Estruturas</strong> como parâmetros <strong>de</strong> funções<br />

void le_coor<strong>de</strong>nada(ponto *p1) {<br />

float x, y;<br />

printf("Digite a coor<strong>de</strong>nada x e y\n");<br />

scanf("%f %f", &x, &y);<br />

p1->x = x;<br />

p1->y = y;<br />

}<br />

en<strong>de</strong>reço variável conteúdo<br />

F000 u | x<br />

F010 u | y<br />

F020 v | x<br />

F030 v | y<br />

F040 p1 F000<br />

F050 x 1.5<br />

F060 y 2.0<br />

F070<br />

le_coor<strong>de</strong>nada(&u);<br />

Similar a vetores, &u<br />

dá o en<strong>de</strong>reço inicial<br />

que a estrutura está<br />

armazenada<br />

27

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!