// http://h...content-available-to-author-only...h.net/test/read.cgi/tech/1320365280/544-545
#include <stdio.h>
#define LEN(array) ((sizeof array) / (sizeof array[0]))
int main(void)
{
double vx[5];
double *vxp;
int i;
printf("%dつの実数を入力してください\n", LEN
(vx
)); for (i = 0, vxp = vx; i < LEN(vx); i++, vxp++) {
}
for (i = 0, vxp = vx; i < LEN(vx); i++, vxp++) {
*vxp *= -1;
}
for (i = 0, vxp = vx; i < LEN(vx); i++, vxp++) {
printf("vx[%d] = %f\n", i
, *vxp
); }
return 0;
}
Ly8gaHR0cDovL2guLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmgubmV0L3Rlc3QvcmVhZC5jZ2kvdGVjaC8xMzIwMzY1MjgwLzU0NC01NDUKI2luY2x1ZGUgPHN0ZGlvLmg+CiNkZWZpbmUgTEVOKGFycmF5KSAoKHNpemVvZiBhcnJheSkgLyAoc2l6ZW9mIGFycmF5WzBdKSkKCmludCBtYWluKHZvaWQpCnsKICAgIGRvdWJsZSB2eFs1XTsKICAgIGRvdWJsZSAqdnhwOwogICAgaW50IGk7CiAgICBwcmludGYoIiVk44Gk44Gu5a6f5pWw44KS5YWl5Yqb44GX44Gm44GP44Gg44GV44GEXG4iLCBMRU4odngpKTsKICAgIGZvciAoaSA9IDAsIHZ4cCA9IHZ4OyBpIDwgTEVOKHZ4KTsgaSsrLCB2eHArKykgewogICAgICAgIHByaW50ZigidnhbJWRdID0gIiwgaSk7CiAgICAgICAgc2NhbmYoIiVsZiIsIHZ4cCk7CiAgICB9CiAgICBmb3IgKGkgPSAwLCB2eHAgPSB2eDsgaSA8IExFTih2eCk7IGkrKywgdnhwKyspIHsKICAgICAgICAqdnhwICo9IC0xOwogICAgfQogICAgcHJpbnRmKCLmraPosqDjgpLlj43ou6LjgZXjgZvjgb7jgZfjgZ/jgIIgXG4iKTsKICAgIGZvciAoaSA9IDAsIHZ4cCA9IHZ4OyBpIDwgTEVOKHZ4KTsgaSsrLCB2eHArKykgewogICAgICAgIHByaW50ZigidnhbJWRdID0gJWZcbiIsIGksICp2eHApOwogICAgfQogICAgcmV0dXJuIDA7Cn0K
prog.c: In function ‘main’:
prog.c:13: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
5つの実数を入力してください
vx[0] = vx[1] = vx[2] = vx[3] = vx[4] = 正負を反転させました。
vx[0] = -1.100000
vx[1] = -2.200000
vx[2] = 3.300000
vx[3] = -4.400000
vx[4] = 5.500000