Advertisement
saira12tabassum19

Untitled

Nov 10th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. struct item{
  4. int itemid;
  5. float price;
  6.  
  7. };
  8. int main()
  9. {
  10. struct item *temp;
  11. temp=(struct item*)malloc(2*sizeof(struct item)); // 2 memory allocate er jonno size
  12. temp->itemid=101; //1 no tate value assign
  13. temp->price=24.5; //1 no tate value assign
  14.  
  15. (temp+1)->itemid=103; //memory address +1 kore porer memory address e 2 no value assign
  16. (temp+1)->price=35.8; //memory address +1 kore porer memory address e 2 no value assign
  17.  
  18. for(int i=0;i<2;i++)
  19. {
  20. printf("%d %f\n",(temp+i)->itemid,(temp+i)->price);
  21. }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement