Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int foo(int *p);
- ////////////////////////////////////////////////////
- int main() //
- {
- int nArr[10] = {4, 4, 10, 4, 4,
- 4, 4, 4, 4, 4};
- int n = foo(&nArr[2]);
- for(int i = 2; i < 12; i++)
- {
- printf("nArr[%d] = %d \n", i, nArr[i]);
- }
- printf(" - - - - - ");
- printf("Summa = %d \n", n);
- }
- //////////////////////////////////////////////////
- int foo(int *p)
- {
- int nS = 0;
- for(int i = 0; i < 10; i++)
- {
- nS += p[i];
- }
- return nS;
- }
- /*
- #include <stdio.h>
- int nArr[10] = {4, 4, 3, 4, 4,
- 4, 4, 4, 4, 4};
- ////////////////////////////////////////////////////
- int main() //
- {
- int nS = 0;
- for(int i = 0; i < 10; i++)
- {
- nS += nArr[i];
- }
- printf("Summa = %d \n", nS);
- }
- */
- /*
- #include <stdio.h>
- ////////////////////////////////////////////////////
- int main() //
- {
- int n = 123;
- int *p = &n;
- printf("address of n = %d \n", &n);
- printf(" p = %d \n", p);
- printf(" *p = %d \n", *p);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement