标题:试试这样学习C语言
只看楼主
sooyahoo
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2008-4-18
得分:0 
嘿嘿,总是爱骂人
从指针开始吧,每天有空写一点(最近常出去不在电脑旁),到下周写完,以后看情况再说写不写。
共同交流吧,再说我也没说啥,只是说C语言我不用再学了,嘿嘿。

题目:指针
第一节 指针初步
1.1 可以认为指针是个“长整型数”
  注意这里的长整型是带引号的,比如下面程序

1:#include "stdio.h"
2:main()
3:{
4:      long a,b,c;
5:      a=30;
6:      printf("\na->%d",a);
7:      printf("\n&a->%ld",&a);
8:      printf("\ninput b as &a ");
9:      scanf("%d",&b);/*//**躲过b=&a;   b=(int *)&a;也是不可能的*/
10:      printf("\input a via b(value)");
11:      scanf("%d",b);
12:      printf("\nnew value of a->%d\n",a);
13:      printf("Bye Bye");
14:      getch();
15:      getch();
16: }

可参考的运行结果:
1:a->30
2:&a->2293620
3:input b as &a 2293620
4:input a via b(value)456

5:new value of a->456
6:Bye Bye

这个程序(注意编译时去掉里面所有中文字符,不然会出个167....错误)及其修改版本(一会说如何修改)常用来说明指针的“本质”,我们经常说指针就是XX的地址,这个程序说明什么是地址。
第5行 给a任意赋了初值30;
第6行 打印出了a的地址,至此见运行结果 第2行
后来 程序第9行 我把看见的a的地址直接赋值给b  效果见运行结果第3行
然后在程序11行(那个明显的“错误行”) 通过标准的“长整型”变量b给a赋值 见运行结果 第4行,因为现在b的“值”就是&a,而scanf函数只要&a的值就可以了。
程序第12行打印被改变了的a的值。明显是我的输入“456”

至此指针的概念我们说明了一半,即指针就是个“数值”,所以以后可以考虑对这个数值运算,但没有说道的问题就是,指针是个有什么样规则的“数值”呢。
.......yong pin yin xie ,wo shi ge chu zi,ta men deng zhe wo zuo fan ne ,晚上见!....
2008-04-26 17:45
sooyahoo
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2008-4-18
得分:0 
解释
我刚看了,我最前面的“留言”,他是说我从printf(“hello ”);那个地方写,后来觉得不妥,太冗长了,大家不会需要吧,先从指针写,其它视情况而定吧。
2008-04-26 17:51
死了都要C
Rank: 4
来 自:四川成都
等 级:贵宾
威 望:13
帖 子:1582
专家分:116
注 册:2006-12-7
得分:0 

女施主``我给你``送茶来了```师太``你就从了老衲吧``
代码本天成~~~妙头偶得之```
2008-04-26 17:52
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
得分:0 
31#的程序不规范
#include<conio.h>

int main()
------------------------

My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2008-04-26 19:32
hddjie
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-4-8
得分:0 
学习学习学习中~~~
2008-04-26 19:36
ronald9
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-4-26
得分:0 
也来 看看
2008-04-26 19:41
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
得分:0 
貌似楼主很强(从顶楼第一个括号中看出)~
不知道可否请教一下:
如何处理识别一个用01表示的字符点阵代表的数字,我曾经做过一个,不过效果不算好啊
如:
程序代码:
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000001111111111111111000000000000000000
0000000000000000000000000011111111111111111111100000000000000000
0000000000000000000000000111111111111111111111100000000000000000
0000000000000000000000001111111111111111111111100000000000000000
0000000000000000000000011111111111111111111111100000000000000000
0000000000000000000000111111111111111111111111110000000000000000
0000000000000000000000111111111111111111111111100000000000000000
0000000000000000000001111111000000000000011111100000000000000000
0000000000000000000001110000000000000000111111000000000000000000
0000000000000000000001100000000000000001111110000000000000000000
0000000000000000000000000000000000000111111000000000000000000000
0000000000000000000000000000000000001111110000000000000000000000
0000000000000000000000000000000000011111100000000000000000000000
0000000000000000000000000000000000111111000000000000000000000000
0000000000000000000000000000000001111110000000000000000000000000
0000000000000000000000000000000011111100000000000000000000000000
0000000000000000000000000000000111111000000000000000000000000000
0000000000000000000000000000001111111000000000000000000000000000
0000000000000000000000000000011111110000000000000000000000000000
0000000000000000000000000000111111100000000000000000000000000000
0000000000000000000000000001111111000000000000000000000000000000
0000000000000000000000000011111110000000000000000000000000000000
0000000000000000000000000011111110000000000000000000000000000000
0000000000000000000000000111111100000000000000000000000000000000
0000000000000000000000001111111000000000000000000000000000000000
0000000000000000000000001111111000000000000000000000000000000000
0000000000000000000000011111110000000000000000000000000000000000
0000000000000000000000111111110000000000000000000000000000000000
0000000000000000000000111111100000000000000000000000000000000000
0000000000000000000001111111100000000000000000000000000000000000
0000000000000000000001111111000000000000000000000000000000000000
0000000000000000000011111111000000000000000000000000000000000000
0000000000000000000011111111000000000000000000000000000000000000
0000000000000000000011111111000000000000000000000000000000000000
0000000000000000000111111110000000000000000000000000000000000000
0000000000000000000111111111110000000000000000000000000000000000
0000000000000000000111111111000000000000000000000000000000000000
0000000000000000000111111110000000000000000000000000000000000000
0000000000000000000111111000000000000000000000000000000000000000
0000000000000000000001100000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000

以上识别为7

再者,最大三维空间(数据规模:x<=30 y<=30 z<=30),您能将时间复杂度降到多少?

背包问题,设最大背包数据为N,物品数为M,如何用O(N)的空间复杂度,动态规划 实现最大装载且输出装载方法(注意,必须满足后者)

楼主回答我吧,谢了

[[it] 本帖最后由 卧龙孔明 于 2008-4-26 19:45 编辑 [/it]]

My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2008-04-26 19:43
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
得分:0 
学无止境,学海无涯
我曾经傲气十足,后来才知道自己水平与真正的高手相差甚远,见识短浅. 虽然现在有时我仍有一些自大,但是我心中已经对自己定位---我是一个水平不高的学生,我没有可以骄傲自大的地方.

My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2008-04-26 19:49
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
得分:0 
最后希望楼主摆正心态.
当然,如果您看到37#后马上能做出答案并给出满意的答复,那么以上几层中的失礼请包涵,那样我会真切地拜您为师

My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2008-04-26 19:52
sunkaidong
Rank: 4
来 自:南京师范大学
等 级:贵宾
威 望:12
帖 子:4496
专家分:141
注 册:2006-12-28
得分:0 
学习可以像吃快餐?也想听听,我的进展很慢...

学习需要安静。。海盗要重新来过。。
2008-04-26 19:57



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-209856-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.049526 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved