Guest User

Untitled

a guest
Jul 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. // Initiera variabler
  5. int firstvalue, secondvalue;
  6.  
  7. // Initiera pointer
  8. int *mypointer;
  9.  
  10. // Set pointer to firstvalue address
  11. mypointer = &firstvalue;
  12.  
  13. // Set the value of the pointed object
  14. *mypointer = 10;
  15.  
  16. // Set pointer to secondvalue address
  17. mypointer = &secondvalue;
  18.  
  19. // Set the value of the pointed object
  20. *mypointer = 20;
  21.  
  22. // Print the firstvalue value
  23. printf("First value: %i\n", firstvalue);
  24.  
  25. // Print the secondvalue value
  26. printf("Second value: %i\n", secondvalue);
  27. }
Add Comment
Please, Sign In to add comment