Advertisement
dinophanhk

[C] Double a number by pointer in function - Sample Code

May 18th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. // Function pointerFunction example
  2. // http://facebook.com/dinophanhk
  3.  
  4. #include "stdio.h"
  5.  
  6. void pointerFunction(int *iNumber) {
  7.     *iNumber *= 2;
  8. }
  9.  
  10. int main(void) {
  11.     int iA;
  12.     printf("Enter number: ");
  13.     scanf("%d", &iA);
  14.     pointerFunction(&iA);
  15.     printf("Result: %d.\n", iA);
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement