递减数组 [英] decrementing arrays

查看:103
本文介绍了递减数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我是否需要指针。我想要数字

10 ^ 16。就像信用卡可能的10个数字的16位数,所以我想这将是b ^ b将是10 ^ 16。所以我有


int num [16] [10];

这些当然是声明的而不是初始化的。现在我想用''\0''来初始化

。我猜测会涉及到( - )。或者也许

for。指针会涉及到这个吗?


通过这个练习,我将学习使用多维

arrary,可能是指针并初始化为零。我尝试使用

putchar这样做,所以我显然不知道该怎么做。有人可以帮我学习这个吗?


比尔


-----

You Big Dummy - Fred Sanford

I don''t know if I''ll need pointers for this or not. I wants numbers
10^16. Like a credit card 16 digits of possible 10 numbers, so I guess that
would be 10^16. So I have

int num [16][10];
These are of course declared and not initialized. Now I want to initialize
them all with ''\0''. That I''m guessing would involve while ( --). Or maybe
for. Would pointers be involved in this?

With this excercise I would learn working with multi-dimensional
arrary, maybe pointers and initializing to zero. I tried to do this using
putchar so I obviously don''t know what to do. Can someone help me learn
this?

Bill

-----
"You Big Dummy" -- Fred Sanford

推荐答案

Bill Cunningham写道:
Bill Cunningham wrote:

我不是知道我是否需要指针。我想要数字

10 ^ 16。就像信用卡可能的10个数字的16位数,
I don''t know if I''ll need pointers for this or not. I wants numbers
10^16. Like a credit card 16 digits of possible 10 numbers,



您的问题不明确。你想要一个可以存储

值到1e16的整数类型吗?你想要一个由16个整数组成的数组,每个整数都可以是
保持十位十进制值吗?

Your question is not clear. Do you want an integer type that can store
values upto 1e16? Do you want an array of 16 integers each of which can
hold a ten digit decimal value?


所以我猜那将是10 ^ 16。所以我有


int num [16] [10];

这些当然是声明的而不是初始化的。现在我想

使用''\0''初始化它们。
so I guess that would be 10^16. So I have

int num [16][10];
These are of course declared and not initialized. Now I want to
initialize them all with ''\0''.



为什么?为什么不只是零?

Why? Why not just zero?


我猜测会涉及到(

- )。或者也许是为了。指针会参与其中吗?
That I''m guessing would involve while (
--). Or maybe for. Would pointers be involved in this?



他们为什么要明确参与。

Why should they be explicitly involved.


通过这个练习,我将学习使用多维

arrary,可能是指针并初始化为零。我试着用putchar做这个

,所以我显然不知道该怎么办。有人可以帮忙吗?b $ b我能学到这个吗?
With this excercise I would learn working with multi-dimensional
arrary, maybe pointers and initializing to zero. I tried to do this
using putchar so I obviously don''t know what to do. Can someone help
me learn this?



所以你想把那个数组设置为零?做:


for(int i = 0; i< 16; i ++)

for(int j = 0; j< 10; j ++)

num [i] [j] = 0;

So you want to set that array to zero? Do:

for (int i = 0; i < 16; i++)
for (int j = 0; j < 10; j++)
num[i][j] = 0;




" santosh" < sa ********* @ gmail.com写信息

新闻:g3 ********** @ registered.motzarella.org ...

"santosh" <sa*********@gmail.comwrote in message
news:g3**********@registered.motzarella.org...

所以你想把那个数组设置为零?做:


for(int i = 0; i< 16; i ++)

for(int j = 0; j< 10; j ++)

num [i] [j] = 0;
So you want to set that array to zero? Do:

for (int i = 0; i < 16; i++)
for (int j = 0; j < 10; j++)
num[i][j] = 0;



哇谢谢Santosh。我已经在代码中看到了这样的东西,但是我的j'的k''s

等等一段时间后开始变得模糊,我只是放弃了。所以现在我知道这意味着什么

。那么随机化呢?所有都设置为零。请问

涉及到什么?


比尔


-----

你大笨蛋 --Fred Sanford

Wow thanks Santosh. I''ve seen things like this in code but the i''s j''s k''s
and so on start to blur after awhile and I just give up. So now I know what
that means. What about randomizing ? So all is set to zero. Would srand be
involved ?

Bill

-----
"You big Dummy" --Fred Sanford


>
>





" santosh" < sa ********* @ gmail.com写信息

新闻:g3 ********** @ registered.motzarella.org ...

"santosh" <sa*********@gmail.comwrote in message
news:g3**********@registered.motzarella.org...

所以你想把那个数组设置为零?做:


for(int i = 0; i< 16; i ++)

for(int j = 0; j< 10; j ++)

num [i] [j] = 0;
So you want to set that array to zero? Do:

for (int i = 0; i < 16; i++)
for (int j = 0; j < 10; j++)
num[i][j] = 0;



为什么在num [i] [j]之后有一个= 0?


Bill


-----

你大假人 - 弗雷德桑福德

Why is there a =0 after num [i][j] ?

Bill

-----
"You big dummy" --Fred Sanford


这篇关于递减数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆