fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int x[5] = {54, 56, 64, 42, 58};
  5. int *p;
  6. int i;
  7. int *max;
  8.  
  9. p = x;
  10. printf("*P = %d\n", *p);
  11. for (i = 0; i < 5; i++) {
  12. printf("*(p+%d) = %d\n", i, *(p + i));
  13. }
  14.  
  15. max = p + 0;
  16. for (i = 1; i < 5; i++) {
  17. if (*max < *(p + i)) {
  18. max = p + i;
  19. }
  20. }
  21. printf("最大値=%d\n", *max);
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0.02s 1676KB
stdin
Standard input is empty
stdout
*P  = 54
*(p+0) = 54
*(p+1) = 56
*(p+2) = 64
*(p+3) = 42
*(p+4) = 58
最大値=64