Apostila Linguagem C III

# Veja o exemplo int count10 int pt ptcount criamos um

• Notes
• 23

This preview shows pages 8–10. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

Nos exemplos acima vemos um primeiro exemplo do funcionamento dos ponteiros. No primeiro exemplo, o código %p usado na função printf() indica à função que ela deve imprimir um endereço. Podemos fazer algumas operações aritméticas com ponteiros. A primeira, e mais simples, é igualar dois ponteiros. Se temos dois ponteiros p1 e p2 podemos igualá-los fazendo p1=p2 . Repare que estamos fazendo com que p1 aponte para o mesmo lugar que p2 . Se quisermos que a variável apontada por p1 tenha o mesmo conteúdo da variável apontada por p2 devemos fazer *p1=*p2 . Basicamente, depois que se aprende a usar os dois operadores ( & e * ) fica fácil entender operações com ponteiros.
This is the end of the preview. Sign up to access the rest of the document.
• Summer '00
• Aula4-IntroducaoC
• int main, vetores, ponteiros, DO CPDEE DA UFMG

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern