Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- test1.c
- You can find all my C programs at Dragan Milicev's pastebin:
- https://pastebin.com/u/dmilicev
- https://www.facebook.com/dmilicev
- */
- #include <stdio.h>
- int *test()
- {
- int i;
- static int x[4];
- for( i=0; i<4; i++ )
- {
- x[i]=i;
- }
- return x;
- }
- int *test1()
- {
- int i;
- static int x[4];
- for( i=0; i<4; i++ )
- {
- x[i]=i%2;
- }
- return x;
- }
- int main(void)
- {
- int i;
- int *arr = test();
- printf("\n test() \n");
- for( i=0; i<4; i++ )
- {
- printf("\n arr[%d] = %d \n", i, *(arr+i));
- }
- arr = test1();
- printf("\n test1() \n");
- for( i=0; i<4; i++ )
- {
- printf("\n arr[%d] = %d \n", i, *(arr+i));
- }
- return 0;
- } // main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement