Guest User

Untitled

a guest
Sep 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. typedef struct
  2. {
  3. unsigned int NumofParam;
  4. double ExperimentResults[3];
  5. double ValueofParamOne[3];
  6. double ValueofParamTwo[3];
  7. }EXP_CONDITION;
  8.  
  9. int main()
  10. {
  11. EXP_CONDITION stInputs;
  12. EXP_CONDITION* pstInputs;
  13. pstInputs = &stInputs;
  14.  
  15. pstInputs->NumofParam = 2U;
  16. EXP_CONDITION ExpNum[3];
  17.  
  18. /*assign values to Experiment 1*/
  19. ExpNum[0].ValueofParamOne[0]=200;
  20. ExpNum[0].ValueofParamTwo[0]=400;
  21. ExpNum[0].ExperimentResults[0]=1000;
  22.  
  23. /*assign values to Experiment 2*/
  24. ExpNum[1].ValueofParamOne[1]=210;
  25. ExpNum[1].ValueofParamTwo[1]=440;
  26. ExpNum[1].ExperimentResults[1]=2000;
  27.  
  28. /*assign values to Experiment 3*/
  29. ExpNum[2].ValueofParamOne[2]=220;
  30. ExpNum[2].ValueofParamTwo[2]=480;
  31. ExpNum[2].ExperimentResults[2]=3000;
  32.  
  33. myfunction(&stInputs);
  34. return 0;
  35. }
  36.  
  37. myfunction(ExpNum);
  38.  
  39. void myfunction(EXP_CONDITION* expNum)
  40. {
  41. double foo = expNum[0].ValueofParamOne[0];
  42. double bar = expNum[1].ValueofParamOne[0];
  43. double baz = expNum[2].ValueofParamOne[0];
  44. // ...
  45. }
Add Comment
Please, Sign In to add comment