小编Bat*_*man的帖子

在C代码中将数组归零

可能的重复:
如何在没有循环的情况下将数组初始化为C语言?
如何在C中初始化数组

如何在不使用for或任何其他循环的情况下将已知大小的数组归零?

例如:

arr[20] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
Run Code Online (Sandbox Code Playgroud)

这是漫长的道路......我需要它的简短方法.

c arrays

37
推荐指数
3
解决办法
12万
查看次数

以下代码有什么作用?

i = i + j ;
j = i - j ;
i = i - j ;
Run Code Online (Sandbox Code Playgroud)

上面的代码是做什么的?有人可以用其他代码编写相同的操作吗?

日Thnx.

java

5
推荐指数
3
解决办法
710
查看次数

我对吗 ? - C表达式

int *(*(*P)[2][2])(int,int);
Run Code Online (Sandbox Code Playgroud)

P是指向具有2个int类型参数的函数的2x2指针数组的指针,它返回一个int类型指针.它是否正确?

c expression

3
推荐指数
1
解决办法
126
查看次数

为什么我的解析器提取的每个包含后都会得到'ÿ'字符?- C

我有这个功能:

/*This func runs *.c1 file, and replace every include file with its content
It will save those changes to *.c2 file*/
void includes_extractor(FILE *c1_fp, char *c1_file_name ,int c1_file_str_len )
{
    int i=0;
    FILE *c2_fp , *header_fp;
    char ch, *c2_file_name,header_name[80]; /* we can assume line length 80 chars MAX*/
    char inc_name[]="include"; 
    char inc_chk[INCLUDE_LEN+1]; /*INCLUDE_LEN is defined | +1 for null*/

    /* making the c2 file name */

    c2_file_name=(char *) malloc ((c1_file_str_len)*sizeof(char));
    if (c2_file_name == NULL)
    {
     printf("Out of memory !\n"); …
Run Code Online (Sandbox Code Playgroud)

c c++

2
推荐指数
1
解决办法
1万
查看次数

减少并增加枚举值

我想创建一个名为increaseValue的方法,它的签名如下:

public Size increaseValue(Size s)
Run Code Online (Sandbox Code Playgroud)

我还有以下声明:

protected enum Size {XS, S, M, L, XL}
Run Code Online (Sandbox Code Playgroud)

我需要知道,如何在不使用Switch-Case语句的情况下使方法返回正确的值(即输入为L时的XL ......等)?

谢谢 !

java enums

1
推荐指数
1
解决办法
476
查看次数

标签 统计

c ×3

java ×2

arrays ×1

c++ ×1

enums ×1

expression ×1