C语言二级指针加括号的问题,很多问题应该 二级指针啊等

得分:10

ca56232b3bbedf9a539d07f37fffb99a.gif

3144d8b7615c79d9f638db40d5689d26.gif

a218af6549b45ee526caf607ebff1358.gif

0f8df0e29816ae721419de940fb833d1.gif

用splint检测后结果如下,供参考

Splint 3.1.2 --- 03 May 2009

test.c: (in function main)

test.c:12:18: Format argument 1 to scanf (%d) expects int * gets unsigned int

*: &num

To ignore signs in type comparisons use +ignoresigns

test.c:12:13: Corresponding format code

test.c:12:5: Return value (type int) ignored: scanf("%d\n", &num)

Result returned by function call is not used. If this is intended, can cast

result to (void) to eliminate message. (Use -retvalint to inhibit warning)

test.c:14:13: Operands of < have incompatible types (int, unsigned int):

i < num

test.c:17:9: Use of gets leads to a buffer overflow vulnerability.  Use fgets

instead: gets

Use of function that may lead to buffer overflow. (Use -bufferoverflowhigh to

inhibit warning)

test.c:17:9: Return value (type char *) ignored: gets(*(ch + i))

Result returned by function call is not used. If this is intended, can cast

result to (void) to eliminate message. (Use -retvalother to inhibit warning)

test.c:20:20: Index of null pointer ch: ch

A possibly null pointer is dereferenced.  Value is either the result of a

function which may return null (in which case, code should check it is not

null), or a global, parameter or structure field declared with the null

qualifier. (Use -nullderef to inhibit warning)

test.c:9:15: Storage ch becomes null

test.c:20:9: Assignment of arbitrary unsigned integral type to int:

len = strlen(ch[i]) - 1

To allow arbitrary integral types to match any integral type, use

+matchanyintegral.

test.c:23:13: Assignment of char to int: n = ch[i][j]

To make char and int types equivalent, use +charint.

test.c:57:17: Operands of < have incompatible types (int, unsigned int):

i < num

test.c:60:21: Operands of < have incompatible types (int, unsigned int):

j < num

test.c:71:17: No argument corresponding to printf format code 2 (%d):

"%s  %d\n"

Types are incompatible. (Use -type to inhibit warning)

test.c:71:30: Corresponding format code

test.c:76:2: Path with no return in function declared to return int

There is a path through a function declared to return a value on which there

is no return statement. This means the execution may fall through without

returning a meaningful result to the caller. (Use -noret to inhibit warning)

test.c:5:14: Parameter argc not used

A function parameter is not used in the body of the function. If the argument

is needed for type compatibility or future plans, use /*@unused@*/ in the

argument declaration. (Use -paramuse to inhibit warning)

test.c:5:25: Parameter argv not used

Finished checking --- 14 code warnings

6f83fddf9cb9ff6843fffd45e1807199.gif

经常不在线不能及时回复短消息,如有c/单片机/运动控制/数据采集等方面的项目难题可加qq1921826084。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值