Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main(){
  6.  
  7. float *temps1;
  8. float *temps2;
  9. float input = 0;
  10. int count = 0;
  11.  
  12. temps1 = malloc(sizeof(float)*5);
  13.  
  14.  
  15. while (input != -100){
  16. printf("Enter temperatures (enter -100 when finished): ");
  17. scanf("%f", &input);
  18. temps1[count] = input;
  19. count++;
  20. temps2 = malloc(sizeof(temps1)*2);
  21. if(count == sizeof(temps1)/sizeof(float)){
  22. temps2 = temps1;
  23. free(temps1);
  24. }
  25. }
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement