Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. Argument 1 is named : test and has the address of : 0x7ffe563f45e3
  2. Argument 2 is named : test123 and has the address of : 0x7ffe563f45e8
  3. Argument 3 is named : hmm and has the address of : 0x7ffe563f45f0
  4. Argument 4 is named : weird and has the address of : 0x7ffe563f45f4
  5.  
  6. ArgumentPointer 1 is named : test and has the address of : 0x7ffe563f45e3
  7. ArgumentPointer 2 is named :��y�U and has the address of : 0x7ffe563f3c08
  8. ArgumentPointer 3 is named : hmm and has the address of : 0x7ffe563f45f0
  9. ArgumentPointer 4 is named : weird and has the address of : 0x7ffe563f45f4
  10.  
  11. #include <stdio.h>
  12.  
  13. int main(int argc, char*argv[])
  14. {
  15. char *arguments[] = { "" };
  16.  
  17. if (argc == 1)
  18. {
  19. printf("There are no Arguments given!nn");
  20. }
  21.  
  22. for (int i = 1; i < argc; i++)
  23. {
  24. arguments[i] = argv[i];
  25. printf("Argument %d is named : %s and has the address of : %pn",i
  26. , arguments[i],
  27. arguments[i]);
  28. }
  29.  
  30. printf("n");
  31.  
  32. char **argumentPointer = arguments;
  33. for (int i = 1; i < argc; i++)
  34. {
  35. printf("ArgumentPointer %d is named : %s and has the address of :
  36. %pn", i, argumentPointer[i],
  37. argumentPointer[i]);
  38. }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement