18.04.2013 Views

Lista de exercícios:

Lista de exercícios:

Lista de exercícios:

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Grupo V - Ponteiros<br />

1. Procure <strong>de</strong>terminar quais valores são impressos ao final <strong>de</strong>ste programa.<br />

Confira sua resposta testando o programa no micro. Execute-o passo a passo<br />

conferindo o valor das variáveis em cada momento.<br />

a) void main()<br />

{<br />

int a,b,*c;<br />

a = 3;<br />

b = 4;<br />

c = &a;<br />

b++;<br />

*c = a+2;<br />

printf("%d %d",a,b);<br />

}<br />

b) void main()<br />

{<br />

int a,b,*c;<br />

a = 4;<br />

b = 3;<br />

c = &a;<br />

*c = *c +1;<br />

c = &b;<br />

b = b+4;<br />

printf("%d %d %d",a,b,*c);<br />

}<br />

c) void main()<br />

{<br />

int a,b,*c,*d,*f;<br />

a = 4;<br />

b = 3;<br />

c = &a;<br />

d = &b;<br />

*c /= 2;<br />

f = c;<br />

c = d;<br />

d = f;<br />

printf("%d %d",*c,*d);<br />

}<br />

d)<br />

int calcula(int);<br />

void main()<br />

{

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

Saved successfully!

Ooh no, something went wrong!