帮助指针 [英] Help with pointers

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

问题描述

我正在尝试编写一个程序,它将使用指针和动态变量来创建链表。我需要帮助读取外部文件并将这些整数放在列表中。然后我需要帮助得到这些整数的总和。


这是我到目前为止所得到的:

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号

解决方案

请问,任何人有什么想法?



请,任何人有任何想法?



修复了一些事情,现在它编译并执行

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


我认为代码有2个问题....

首先声明前面但是从不设置任何东西(因此第一个奇怪的输出)

其次, [ctrl z]是一个字符并被添加到列表中,所以我们读了太多元素。


我已经搞砸了(被修改过)它并且有些东西我认为有效....

展开 | 选择 | Wrap | 行号

I am trying to write a program that will use pointers and dynamic variables to create a linked list. I need help reading the external file and placing those integers in the list. Then I need help arriving at the sum of those integers.

Here''s what I''ve got so far:

Expand|Select|Wrap|Line Numbers

解决方案

Please, Anyone have any ideas?


Please, Anyone have any ideas?

fixed a few things so it now compiles and executes

Expand|Select|Wrap|Line Numbers


I think there are 2 problems with the code....
Firstly front is declared but never set to anything (hence the first strange output)
Secondly, [ctrl z] is a character and is added to the list, so we read too many elements.

I have messed around with(that is modified) it and have somethiong I think works....

Expand|Select|Wrap|Line Numbers


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

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