寻找一本重点关注数据类型的C教科书 [英] Looking for a C textbook with emphasis on data types

查看:81
本文介绍了寻找一本重点关注数据类型的C教科书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我本来应该教一个不寻常的倾向的入门C课程,

并且找不到合适的教科书。这个课程将开始传统上使用变量,循环,条件,结构,

指针和fopen / fclose。然而,除此之外,我所看到的每门课程和b * b b教科书对数据*结构都很重要*,如果有的话,会轻易触及其他

主题。而我需要强调数据*类型*,

将它们转换为另一个,并进行位操作。

结束课程我不在乎我的学生是否知道链表是​​什么,让

单独一个二叉树,但他们必须对ASCII有很好的理解,

二进制和十六进制。例如,它必须向他们清楚为什么数字

353实际存储为0x01 0x61如果它是和INT,但是0x33 0x35 0x33

如果它是's CHAR *。或者为什么将数字CHAR转换为INT涉及

减去48 - 而不是30,如前面的例子所示。


是否有教科书强调数据类型,位和

十六进制,还是我注定要写自己的?

解决方案

< blockquote> il***@rcn.com 说:


< snip>


结束

课程我不在乎我的学生知道链表是​​什么,让

一个二进制树,但他们必须对ASCII有很好的理解,



为什么?这与C无关。


二进制和十六进制。例如,它必须向他们清楚为什么数字

353实际存储为0x01 0x61如果它是和INT,



那里C中没有INT类型.353可能存储为0x0161,但可能存储为0x6101,0x00006101(即4个八位位组),或者为0x61010000(小
$ b $) b endian,四个八位字节到int),或者以其他任何方式。


但是0x33 0x35 0x33如果它是CHAR *。



C没有CHAR类型。要存储字符3,5和3,您需要

三个字节的存储空间。指向第一个字符的指针将是/ b $ b /不是/具有值0x333533(除非通过一些惊人的巧合)。


或者为什么将数字CHAR转换为INT涉及

减去48 -



它没有。如果你的意思是将''4'变成4或'6'变成6,它会涉及

减去''0'而不是48。


而不是30,正如前面的例子所暗示的那样。


是否有一本教科书如此强调数据类型,位和

十六进制,还是我注定要写自己的?



我的话。拜托,拜托,请不要自己写,直到你了解你在说什么。


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上面的域名(但显然放弃了www)



il *** @ rcn.com 写道:


我应该教一个介绍性的C当然有一个不寻常的倾斜,

并且无法找到合适的教科书。这个课程将开始传统上使用变量,循环,条件,结构,

指针和fopen / fclose。然而,除此之外,我所看到的每门课程和b * b b教科书对数据*结构都很重要*,如果有的话,会轻易触及其他

主题。



你在谈论任何C书或一些数据结构书吗?


>而我需要压力数据*类型*,



是否需要?


将它们转换为另一个,和位操纵。

结束课程我不在乎我的学生是否知道链表是​​什么,让

单独一个二叉树,但他们必须对ASCII有很好的理解,

二进制和十六进制。



其中哪些是C?


>例如,它必须清除为什么数字

353实际存储为0x01 0x61如果它是和INT,



是吗?它的新闻。如果您使用的是带小端的机器

字节排序怎么办?


>但是0x33 0x35 0x33

如果它是CHAR *。



数字353如何成为char * ??


>或者为什么要将数字CHAR转换为INT涉及

减去48 - 而不是30,正如前面的例子所暗示的那样。



谁叫你减去30?

你必须减去''0''。当你在读取
时,你会错过''0x'。

应该是0x30。


是否有一本教科书如此强调数据类型,位和
十六进制,或者我注定要写自己的?



哎呀...

请不要,,,为了上帝的缘故。


去读取圣书 ,C编程语言,由K& R.


" arun"写道:


>是否有一本强调数据类型,位和十六进制的教科书,或者是我注定要写自己的?



哎呀...

不,请,为了上帝的缘故。



想想孩子们!!!


I am supposed to teach an introductory C course with an unusual slant,
and have trouble finding an appropriate textbook. The course will begin
traditionally enough with variables, loops, conditionals, structures,
pointers and fopen/fclose. Beyond that, however, every course and
textbook I had seen is heavy on data *structures*, and touches on other
topics lightly if at all. Whereas I need to stress data *types*,
converting them one into the other, and bit manipulation. By the end of
the course I do not care if my students know what a linked list is, let
alone a binary tree, but they must have good understanding of ASCII,
binary and hexadecimal. For example, it must clear to them why number
353 is actually stored as 0x01 0x61 if it''s and INT, but 0x33 0x35 0x33
if it''s a CHAR*. Or why converting a numeric CHAR into an INT involves
subtracting 48 -- and not 30, as previous example might suggest.

Is there a textbook with such emphasis on data types, bits, and
hexadecimal, or am I doomed to writing my own?

解决方案

il***@rcn.com said:

<snip>

By the end of
the course I do not care if my students know what a linked list is, let
alone a binary tree, but they must have good understanding of ASCII,

Why? That has nothing to do with C.

binary and hexadecimal. For example, it must clear to them why number
353 is actually stored as 0x01 0x61 if it''s and INT,

There is no INT type in C. 353 might be stored as 0x0161, but it might be
stored as 0x6101, 0x00006101 (i.e. in 4 octets), or as 0x61010000 (little
endian, four octets to the int), or in any of a zillion other ways.

but 0x33 0x35 0x33 if it''s a CHAR*.

C has no CHAR type. To store the characters ''3'', ''5'', and ''3'', you need
three bytes of storage. A pointer to the first of these characters will
/not/ have the value 0x333533 (unless by some astounding coincidence).

Or why converting a numeric CHAR into an INT involves
subtracting 48 --

It doesn''t. If you mean turning ''4'' into 4 or ''6'' into 6, it involves
subtracting ''0'', not 48.

and not 30, as previous example might suggest.

Is there a textbook with such emphasis on data types, bits, and
hexadecimal, or am I doomed to writing my own?

Oh my word. Please, please, please don''t write your own, until you
understand what you''re talking about.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)



il***@rcn.com wrote:

I am supposed to teach an introductory C course with an unusual slant,
and have trouble finding an appropriate textbook. The course will begin
traditionally enough with variables, loops, conditionals, structures,
pointers and fopen/fclose. Beyond that, however, every course and
textbook I had seen is heavy on data *structures*, and touches on other
topics lightly if at all.

Are you talking about any C book or some data structures book ?

>Whereas I need to stress data *types*,

Is it required ?

converting them one into the other, and bit manipulation. By the end of
the course I do not care if my students know what a linked list is, let
alone a binary tree, but they must have good understanding of ASCII,
binary and hexadecimal.

Which of these is ''C'' ?

>For example, it must clear to them why number
353 is actually stored as 0x01 0x61 if it''s and INT,

Is it ?? its NEWS. What if you are using a machine with little endian
byte ordering ?

>but 0x33 0x35 0x33
if it''s a CHAR*.

How can number 353 be char * ??

>Or why converting a numeric CHAR into an INT involves
subtracting 48 -- and not 30, as previous example might suggest.

Who told you to subtract 30 ?
You have to subtract '' 0''. And you would have missed '' 0x'' while you
were reading.
It should have been 0x30.

Is there a textbook with such emphasis on data types, bits, and
hexadecimal, or am I doomed to writing my own?

Ooops...
No please,,, for god''s sake.

Go and read " the holy book" , The C programming language, by K & R.


"arun" writes:

>Is there a textbook with such emphasis on data types, bits, and
hexadecimal, or am I doomed to writing my own?


Ooops...
No please,,, for god''s sake.

Think of the children!!!


这篇关于寻找一本重点关注数据类型的C教科书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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