Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int *item;
- int limit=2,i=0;
- item=(int*)malloc(limit*sizeof(int));
- float *price=(float*)malloc(limit*sizeof(float));
- if(item==NULL&&price==NULL)
- {
- printf("Insufficient Memory, Exiting... \n");
- return 0;
- }
- i=0;
- *(item+i)=101;
- *(price+i)=24.5;
- i++;
- *(item+i)=103;
- *(price+i)=35.8;
- for(i=0; i<limit; i++)
- printf("Item=%d Price= %.1f\n",*(item+i),*(price+i));
- free(item);
- free(price);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement