Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- int main()
- {
- int *ptr,j,temp;
- ptr=(int *)malloc(sizeof(int)*10);
- printf("%X %d \n\n",ptr);
- int i;
- for(i=0;i<5;i++)
- {
- scanf("%d",ptr+i);
- }
- for(i=0;i<5;i++)
- {
- printf("%X %d\n",(ptr+i),*(ptr+i));}
- for(i=0;i<9;i++)
- {
- for(j=0;j<9-i;j++)
- {
- if(*(ptr+j)>(ptr+j+1))
- {
- temp=*(ptr+j);
- *(ptr+j)=*(ptr+j+1);
- *(ptr+j+1)=temp;
- }
- }
- }
- for(i=0;i<5;i++)
- {
- printf("%X %d\n",(ptr+i),*(ptr+i));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement