Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void foo(int &p);
- ///////////////////////////////////////////////
- int main()
- {
- int n = -5;
- foo(n);
- }
- void foo(int &a)
- {
- printf("%d \n", a);
- }
- /*
- #include <stdio.h>
- int n = 12; // переменная
- int *p = &n; // Указатель (работает с адресом переменной)
- int &a = n; // Ссылка
- ///////////////////////////////////////////////
- int main()
- {
- printf(" p = %d\n", p);
- printf("&n = %d\n", &n);
- printf("&p = %d\n", &p);
- printf(" a = %d\n", a);
- printf(" n = %d\n", *p);
- return 0;
- }
- */
- /*
- #include <stdio.h>
- int n = 12;
- int *p = &n;
- ///////////////////////////////////////////////
- int main()
- {
- printf(" p = %d\n", p);
- printf("&n = %d\n", &n);
- return 0;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement