Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void foo(int *);
- //////////////////////////////////////////////////////////
- int main()
- {
- int nArr[10] = {44, 1, 2, 3, 4, 55, 6, 7, 8, 9};
- foo(nArr);
- }
- //////////////////////////////////////////////////////////
- void foo(int *p)
- {
- for(int i = 0; i < 10; i++)
- {
- printf("nArr[%d] = %2d \n", i, p[i]);
- }
- }
- /*
- #include <stdio.h>
- char sz[99] = "nArr = %d \n";
- //////////////////////////////////////////////////////////
- int main()
- {
- printf("sz[1] = %c \n", sz[1]);
- }
- */
- /*
- #include <stdio.h>
- int nArr[10] = {44, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- char sz[99] = "nArr = %d \n";
- //////////////////////////////////////////////////////////
- int main()
- {
- printf(sz, nArr );
- printf("nArr = %d \n", &nArr[0]);
- printf("nArr = %d \n", &nArr[1]);
- printf("printf = %d \n", printf );
- printf("size of sz = %d \n", sizeof(sz) );
- }
- */
- /*
- #include <stdio.h>
- int nArr[10] = {44, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- //////////////////////////////////////////////////////////
- int main()
- {
- int *p = &nArr[4];
- printf("&nArr[4] = %d \n", p );
- printf("&nArr[4] = %d \n", &nArr[4]);
- printf("&nArr[5] = %d \n", &nArr[5]);
- printf("&nArr[5] = %d \n", p + 1 );
- printf("&nArr[5] = %d \n", &p[1] );
- printf("&nArr[5] = %d \n", p[1] );
- }
- */
- /*
- #include <stdio.h>
- int n = 44;
- //////////////////////////////////////////////////////////
- int main()
- {
- printf("address of n = %d \n", &n);
- int *p = &n;
- printf("address of n = %d \n", p);
- printf("address of p = %d \n", &p);
- }
- */
- /*
- #include <stdio.h>
- //////////////////////////////////////////////////////////
- void foo(char *c) //
- {
- // printf("adress nArr = %s\n", c);
- char cBuf = c[0];
- c[0] = c[3];
- c[3] = cBuf;
- cBuf = c[1];
- c[1] = c[2];
- c[2] = cBuf;
- }
- //////////////////////////////////////////////////////////
- int main()
- {
- char nArr[6] = "SONY";
- foo(nArr);
- printf("nArr = %s\n", nArr);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement