memset o / p不正确 [英] memset o/p not correct
问题描述
以下实际上是模式匹配程序的一部分
i尝试过,memset没有用
-1
#include< string.h>
#include< stdio.h>
#include< stdlib.h>
int main(无效)
{
int maxpat [80];
memset(maxpat,-1,80);
for(i = 0; i< 80; i ++)
printf("%d \ t",maxpat [i]);
返回EXIT_SUCCESS;
}
但是我得到了o / p
-1 -1 -1 -1 -1 -1 -1 -1
-1 -1
-1 -1 -1 -1 -1 -1 -1 -1
-1 -1
- 370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 - 370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
D:\ siju\lcc6 \ noisedisp.exe"
返回代码0
执行时间0.048秒
按任意键继续......
为什么会这样...... ????
Hi,
the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int maxpat[80];
memset(maxpat,-1,80);
for(i=0;i<80;i++)
printf("%d\t",maxpat[i]);
return EXIT_SUCCESS;
}
but i am getting o/p as
-1 -1 -1 -1 -1 -1 -1 -1
-1 -1
-1 -1 -1 -1 -1 -1 -1 -1
-1 -1
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
"D:\siju\lcc6\noisedisp.exe"
Return code 0
Execution time 0.048 seconds
Press any key to continue...
why is this so..????
推荐答案
对不起我忘了宣布我,但仍然是o / p是相同的
#include< string.h>
#include< stdio.h>
#include< stdlib.h>
int main(无效)
{
int maxpat [80] ,i;
memset(maxpat,-1,80);
for(i = 0; i< 80; i ++)
printf (曲ot;%d \t",maxpat [i]);
返回EXIT_SUCCESS;
}
sorry I forgot to declare i , but still the o/p is same
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int maxpat[80],i;
memset(maxpat,-1,80);
for(i=0;i<80;i++)
printf("%d\t",maxpat[i]);
return EXIT_SUCCESS;
}
4月20日,2:28 * am,aark ... @ gmail.com写道:
On Apr 20, 2:28*am, aark...@gmail.com wrote:
以下实际上是模式匹配程序的一部分
i尝试过,memset没有设置整个整数数组
-1
* #include< string.h>
* #include< stdio.h>
* #include< stdlib.h>
* int main(无效)
* {
* * int maxpat [80];
* * memset(maxpat,-1,80);
* * for(i = 0; i< 80; i ++)
* * printf("%d \t",maxpat [i]);
* *返回EXIT_SUCCESS;
*}
但是我得到了o / p
-1 * * * -1 * * * -1 * * * -1 * * * -1 * * * -1 * * * -1 * * * -1
-1 * * * -1
-1 * * * -1 * * * -1 * * * -1 * * * -1 * * * -1 * * * -1 * * * -1
-1 * * * -1
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
" D:\ siju\lcc6 \ noisedisp.exe"
返回代码0
执行时间0.048秒
按任意键继续...
为什么这是所以..????
Hi,
the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1
*#include <string.h>
*#include <stdio.h>
*#include <stdlib.h>
*int main(void)
*{
* *int maxpat[80];
* *memset(maxpat,-1,80);
* *for(i=0;i<80;i++)
* *printf("%d\t",maxpat[i]);
* *return EXIT_SUCCESS;
*}
but i am getting o/p as
-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1
-1 * * *-1
-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1 * * *-1
-1 * * *-1
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
-370086 -370086 -370086 -370086 -370086 -370086 -370086 -370086
-370086 -370086
"D:\siju\lcc6\noisedisp.exe"
Return code 0
Execution time 0.048 seconds
Press any key to continue...
why is this so..????
抱歉,我忘了申报i,但o / p仍然相同
sorry I forgot to declare i, but still the o/p is same
aa ***** @ gmail.com 写道:
以下实际上是模式匹配程序的一部分,
i尝试过,memset没有设置整个整数数组
-1
#include< string.h>
#include< stdio.h>
#include< stdlib.h>
int main(无效)
{
int maxpat [80];
memset(maxpat,-1,80);
Hi,
the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int maxpat[80];
memset(maxpat,-1,80);
您只设置数组的前80个字节,而不是80个整数。 br />
-
Ian Collins。
You are only setting the first 80 bytes of the the array, not 80 ints.
--
Ian Collins.
这篇关于memset o / p不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!