Advertisement
gtw7375

Ponteiro C

Oct 27th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. main(){
  4.  
  5. char nome[5] = "Maria",*ponteiroch;
  6. int idade=20, *pontint;
  7. float nota=7.0, *ptrfloat;
  8.  
  9.  
  10. printf("\n Nome:%s\n Idade:%d\n Nota:%.2f\n\n\n",nome, idade, nota);
  11.  
  12. ponteiroch=&nome;
  13. *ponteiroch= "Joaoi";
  14.  
  15. pontint=&idade;
  16. *pontint = 30;
  17.  
  18. ptrfloat=&nota;
  19. *ptrfloat =6.0;
  20.  
  21.  
  22.  
  23. printf("valores alterados pelo ponteiro:\n\n Nome:%s\n Idade:%d\n Nota:%.2f\n ", *ponteiroch, *pontint, *ptrfloat);
  24.  
  25.  
  26. system("pause");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement