Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Argument 1 is named : test and has the address of : 0x7ffe563f45e3
- Argument 2 is named : test123 and has the address of : 0x7ffe563f45e8
- Argument 3 is named : hmm and has the address of : 0x7ffe563f45f0
- Argument 4 is named : weird and has the address of : 0x7ffe563f45f4
- ArgumentPointer 1 is named : test and has the address of : 0x7ffe563f45e3
- ArgumentPointer 2 is named :��y�U and has the address of : 0x7ffe563f3c08
- ArgumentPointer 3 is named : hmm and has the address of : 0x7ffe563f45f0
- ArgumentPointer 4 is named : weird and has the address of : 0x7ffe563f45f4
- #include <stdio.h>
- int main(int argc, char*argv[])
- {
- char *arguments[] = { "" };
- if (argc == 1)
- {
- printf("There are no Arguments given!nn");
- }
- for (int i = 1; i < argc; i++)
- {
- arguments[i] = argv[i];
- printf("Argument %d is named : %s and has the address of : %pn",i
- , arguments[i],
- arguments[i]);
- }
- printf("n");
- char **argumentPointer = arguments;
- for (int i = 1; i < argc; i++)
- {
- printf("ArgumentPointer %d is named : %s and has the address of :
- %pn", i, argumentPointer[i],
- argumentPointer[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement