Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h> //TO JEST 13
- void swap(int *a,int *b)
- {
- int temp = *a;
- *a = *b;
- *b = temp;
- }
- int main(int argc, char **argv)
- {
- int array[2] = {0};
- int realNumber;
- printf("array[0] is %d\n",array[0]);
- printf("array[1] is %d\n",array[1]);
- //printf("array[2] is %d\n",array[2]);
- printf("enter the first real number:\n");
- scanf("%d",&realNumber);
- array[0] = realNumber;
- printf("enter the second real number:\n");
- scanf("%d",&realNumber);
- array[1] = realNumber;
- // printf("enter the third real number:\n");
- //scanf("%d",&realNumber);
- //array[2] = realNumber;
- printf("array[0] is %d\n",array[0]);
- printf("array[1] is %d\n",array[1]);
- //printf("array[2] is %d\n",array[2]);
- swap(array,array+1);
- printf("after swapping...\n");
- printf("array[0] is %d\n",array[0]);
- printf("array[1] is %d\n",array[1]);
- //printf("array[2] is %d\n",array[2]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement