亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? ptr_help.txt

?? 匯編源代碼大全
?? TXT
字號(hào):
Date:   Tue Jun 16 1992  11:05:08
From:   Ted Jensen
To:     Michael Halcrow
Subj:   Pointers & things
Attr:   
international C echo
-------------------------------
Michael-
 
   In reading your messages to Mike Dalsanto, Robert Place, and
All I see you need some help on pointers, arrays, and strings.
Perhaps the following will help:
 
   A string is a one dimensional array of characters.  A one
dimensional array of a given type is contiguous in memory with
each element following in memory the one preceding it.
 
   A pointer is a variable much like any other variable.  For
example, let's consider a more easily understood variable, the
integer:
 
    int k;
 
    defines an integer and reserves x bytes of space in memory
for its storage.  The number of bytes reserved depends on the
system and/or compiler.  For DOS systems an integer requires 2
bytes of storage.  Defining an integer, as above, does not give
it a value.  If it is defined as a global variable, it will be
intialized it to zero.  If it is defined as an auto variable
(i.e. within a function) its value is indeterminate (i.e. a
random value).  Before use, the safest thing to do with any
variable is to intialize it to some value (though in this case
most (all?) compilers will intialize it to zero if it is global.
 
    Now, let's look at a pointer to the type integer which can be
defined as:
 
    int *int_ptr;
 
    defines a pointer and reserves x bytes of space in memory for
its storage.  The number of bytes reserved depends on the system
and/or compiler.  But, fundamentally, since a pointer is designed
to hold an address in memory, it must reserve the number of bytes
necessary to contain such an address.  Defining a pointer, as
above, does not give it a value.  If it is defined as a global
variable it will be initialzed to a NULL, i.e. the address it
will contain (which is the same as saying "the address to which
it points to") will be set to a value of NULL which is #defined
in <stdio.h>.  In DOS systems, NULL is defined as the address of
the first byte of the data segment.  In Borland products, the
first few bytes of the data segment contain a copyright notice.
Before use, a pointer _must_ be "pointed at something", i.e.
assigned a value equal to the address of some data item. More on
this later.
 
    The key to understanding pointers is to remember that they
are variables which contain addresses and that when we say a
pointer "points to something", we mean that it contains the
address of another variable or some other point in memory (such
as the video screen buffer).
 
    Suppose now, that I want to "point" my integer pointer,
int_ptr, at my integer k.  We do this as follows:
 
    int_ptr = &k;
 
    Why use the '&'?  Well, let's say k = 7;, were we to write
"int_ptr = k;" we would be "pointing our pointer" at memory
location 7.  But what we want is to "point our pointer" to the
memory location where the value of k is stored, which is an
entirely different thing.  By preceding the 'k' with the '&' we
get the that address where the value of k is stored and point the
pointer where we intend.
 
    Now, let's move on to arrays, and eventually arrays of
characters which, in some languages, are called strings.  But
first, let's discuss an array of integers as in:
 
    int int_array[5];
 
defines an array capable of holding 5 integers.  We could then
intialize these with statement such as:  int_array[0] = 4; ,
int_array[1] = 7 , etc.  Or, we could initialize the array at the
same time as we define it with:
 
    int int_array[5] = { 4, 7, 2, -2, 6 };
 
    The 5 memory locations for these integers will be contiguous
in memory, i.e. if the 4 is stored at memory location 1000, it is
gauranteed that the 7 will be stored at memory location 1002
(recall an integer takes 2 bytes of storage) and the 2 will be
stored at 1004, etc.
 
    Recall that we stated that &k returned the address where the
value of the integer k was stored.  Similarly
 
        &int_array[0]    will return the memory location of the
first integer in the array.  Thus, if we want to point our
pointer at the array (i.e. the first element of the array) we can
write:
 
    int_ptr = &int_array[0];
 
However, with arrays, there is a second option.  The name of our
array will also return the memory location of the first element.
This means that we can write:
 
    int_ptr = int_array;
 
and get exactly the same result.
 
    With that as background, let's now turn to "strings", (called
character arrays in C).  Everything we said about integer arrays
can also be said about character arrays.  Thus:
 
    char c_array[20];   /* reserves space for 20 characters */
    char *c_ptr;        /* an (unitialized) pointer to a
                           character */
 
    c_ptr = &c_array[0];    /* points the pointer at the first
                               char of the array ("string") */
 
    c_ptr = c_array;        /* does the same */
 
    Note that &c_array is meaningless.
 
    char c_array[] = { 'M', 'i', 'c', 'h', 'a', 'e', 'l', '\0' };
 
    This last line intializes c_array to hold "Michael".
However, with character arrays, the above line can be written
using a sort of shorthand as:
 
    char c_array[] = "Michael";
 
    Note that in the later case, the space reserved will be 8
bytes and the 8th byte will automatically be set to '\0' so that
this syntax is, in fact, shorthand for the longer method
preceding it.
 
    Now, let's to back to pointers and discuss them in context
with functions.  Consider the following function:
 
    void do_something(int k, int *p);
 
    If you have studied functions you know that parameters are
passed by _value_.  That is, if k = 7, what gets passed as a
parameter is the value 7 (as distinguished from the address of
k).  Similarly, what gets passed for the second parameter is the
value of p.  But, the value of p is an address.  Thus, the
following three calls to do_something are equivalent:
 
    int k = 7;
    int int_arr[5] = { 1, 2, 3, 4, 5 };
    int *pk;
    int *pa;
    pk = &k;
    pa = int_arr;
 
    do_something( 3, pk );
    do_something( 3, &k );
 
Similarly, these three calls to our function
 
    do_something( 3, pa);
    do_something( 3, &int_arr[0]);
    do_something( 3, int_arr);
 
are identical, i.e. the _value_ of the second parameter is the
same in all three cases.  This frees the programmer to choose
that approach which he/she is more comfortable with.
 
Now, let's talk about "strings" some more.  There is one more
kind of "string" that we have yet to discuss.  It is called the
"literal string".  A literal string is any string in your code
that appears in quotes.  Thus, in all the following cases the
string "l_string" is a literal string.
 
    char s_arr[] = "l_string";
    fopen("my_file", "wb");
    strcpy(s_arr, "l_string");
    printf("This is a test");

During the compilation process, whenever and where ever the
compiler sees a literal string it a) reserves space in the data
segment to hold the string, b) puts the string within the quotes
in that space and terminates it with the '\0' character, and c)
replaces the literal string in the statement with a pointer
"pointing to" the memory location where it is stored.
 
Thus, for example, if the compiler sees:
 
     strcpy(s_arr, "l_string");
 
it moves the characters "l_string\0" to a memory location in the
data segment, lets say it is at DS:0205.  It then "modifies" the
statement to read:
 
    strcpy(s_arr, DS:0205);   And if s_arr is located at DS:0097,
 
it becomes:
 
    strcpy(DS:0097, DS:0097);
 
Thus, if you look at the prototype for strcpy(), located in
<string.h>, you will see something like:
 
    char *strcpy(char *p1, char *p2);
 
which indicates that this function should be passed "pointers".
But, now we know that it _really_ means that the function should
be passed the _values_ of these pointers, which are _addresses_.
And because we also recognize that the compiler replaces literal
strings with addresses, a statment such as:
 
    strcpy(s_arr, "Michael");
 
begins to make some sense (at least I hope it does!).
 
Michael, I have just scratched the surface here.  Other things
that need "going into" include how and why the compiler _always_
converts array notation to pointer notation as in converting:
 
    a[n]     to       *(a + n);
 
Why are arrays always based at zero?  i.e. why is the first
element of an array always referred to as array[0] and not
array[1]?  Why does something like:
 
    char *p = "This is a test";
 
initialize a string much the same as;
 
    char arr[] = "This is a test";   but with different results.
 
There are dozens of other issues that you will learn as you gain
experience.  In the long run, you will find that C is much more
powerful than BASIC.  But, having the power makes it more
difficult to use.  One can add, subtract, multiply or divide with
pencil and paper, and this is the way we all learn in the
beginning.  A little later we learn there is a machine that we
can use to do this called a calculator, and this does things
faster.  Further more, calculators come in various degrees of
complexity, including some that can be programmed.  When using
the more complex calculators we must have a little more knowledge
and take a little more care to avoid errors.
 
As we move up this chain of experience we eventually come to
computers where, once again, we can still add, subtract,
multiply, and divide, but to do so (in a program) requires still
more knowledge and care.  With each increase in power comes the
need for more knowledge and the attainment of more flexibility
(ever try and do wordprocessing on a four function calculator?).
 
If you want to use sharper knives to make your task easier, you
just have to be more careful not to cut yourself since the cut
will go a lot deeper!
 
At the point you are in your development of skills with C, I
_strongly_ recommend you purchase:
 
    "The C Programming Language"   (2nd edition)
     Kernighan and Ritchie
     Prentice Hall
 
This is the 2nd edition of the book that started it all.  The
authors were the ones who developed the C language and the book,
often referred to as K&R or K&R2, is the _true_ bible for C
users.  If you start at page 1, take it slow, and read it
carefully, it will really pay off and it won't be any time at all
before you are answering the questions here that you are now
asking!
 
Hope this helps!   ... and good luck!

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品888| 国产精品99久久久| 国产欧美精品一区二区色综合朱莉| 91香蕉视频黄| 日本在线不卡视频| 亚洲欧美怡红院| 亚洲精品一线二线三线无人区| 99麻豆久久久国产精品免费| 韩国三级中文字幕hd久久精品| 亚洲已满18点击进入久久| 久久久99久久| 欧美电视剧在线看免费| 欧美日韩一区视频| av激情亚洲男人天堂| 九九**精品视频免费播放| 午夜欧美电影在线观看| 亚洲视频在线观看三级| 国产欧美日本一区二区三区| 欧美videossexotv100| 欧美日韩国产美女| 色妹子一区二区| 成人18视频在线播放| 黄色资源网久久资源365| 午夜视频久久久久久| 亚洲激情网站免费观看| 中文字幕在线一区二区三区| 久久亚洲精品国产精品紫薇| 精品久久人人做人人爽| 日韩一区二区免费在线电影| 欧美久久久久久久久中文字幕| 在线一区二区观看| 日本丶国产丶欧美色综合| voyeur盗摄精品| 成人h动漫精品一区二区| 国产98色在线|日韩| 国产精品1024久久| 国产成人aaa| 成人综合婷婷国产精品久久蜜臀| 国产在线精品国自产拍免费| 精品一区二区影视| 国产精品一区二区在线观看网站| 亚洲精品国产无套在线观| 日韩一二三四区| 欧美一区二区三区在线观看| 黄网站免费久久| 亚洲电影一级片| 亚洲国产精品99久久久久久久久| aaa欧美色吧激情视频| 日本不卡中文字幕| 尤物av一区二区| 国产精品网站在线播放| 国产午夜精品久久久久久久| 一区二区三区成人| 制服.丝袜.亚洲.中文.综合| 欧美精品日韩综合在线| 日韩视频一区二区三区在线播放| 91精品国产综合久久小美女| 欧美v亚洲v综合ⅴ国产v| 国产欧美一二三区| 亚洲欧美日韩国产中文在线| 一区二区国产视频| 日产国产欧美视频一区精品| 蜜臀av一级做a爰片久久| 久久99国产精品免费| 成人夜色视频网站在线观看| 亚洲一区二区三区四区五区黄| 亚洲欧洲精品一区二区精品久久久| 亚洲激情校园春色| 香港成人在线视频| 亚洲欧洲精品一区二区三区不卡 | 日韩限制级电影在线观看| 国产黄人亚洲片| 国产精品羞羞答答xxdd | 2020国产精品| 久久精品夜色噜噜亚洲a∨| 国产精品欧美精品| 一区二区视频在线| 蜜臀av一级做a爰片久久| 成人综合婷婷国产精品久久免费| 在线观看免费一区| xnxx国产精品| 夜夜嗨av一区二区三区四季av | 综合久久综合久久| 男男成人高潮片免费网站| 国产91精品欧美| 欧美久久久久久久久| 欧美国产精品久久| 热久久久久久久| 99久久婷婷国产综合精品电影 | 2021国产精品久久精品| 一区二区三区在线免费观看| 久久精品久久99精品久久| 亚洲欧美日韩国产一区二区三区| 另类调教123区| 亚洲精品在线电影| 国产一区二区三区在线看麻豆 | 粉嫩av一区二区三区粉嫩| 国产盗摄精品一区二区三区在线| 在线观看区一区二| 久久久久久毛片| 日韩高清在线观看| 99国内精品久久| 亚洲精品国产成人久久av盗摄| 日韩欧美精品在线视频| 亚洲黄色在线视频| 国产精品小仙女| 欧美高清你懂得| 亚洲青青青在线视频| 国产一区二区在线观看视频| 777a∨成人精品桃花网| 亚洲日本青草视频在线怡红院 | 欧美一区二区在线免费观看| 亚洲欧洲精品成人久久奇米网| 精品一区二区在线播放| 538prom精品视频线放| 悠悠色在线精品| 北条麻妃一区二区三区| 久久久不卡影院| 久久精品国产99| 欧美一区二区日韩| 天天综合日日夜夜精品| 欧美午夜精品一区二区三区| 亚洲人午夜精品天堂一二香蕉| 福利视频网站一区二区三区| 精品三级av在线| 蜜桃视频一区二区三区在线观看 | 91香蕉视频在线| 亚洲欧洲国产专区| 成人黄动漫网站免费app| 久久精品这里都是精品| 国产在线乱码一区二区三区| 精品久久国产老人久久综合| 日本最新不卡在线| 日韩三级免费观看| 麻豆91在线看| 亚洲精品在线免费观看视频| 久久99九九99精品| 日韩精品一区二区三区视频| 看国产成人h片视频| 精品三级在线看| 国产成人精品影视| 国产精品亲子伦对白| 成人99免费视频| 一区二区三区四区蜜桃| 欧美在线免费视屏| 免费欧美在线视频| 久久久久久久久久久黄色| 精品在线视频一区| 一区二区三区四区在线免费观看| 亚洲无人区一区| 亚洲一区中文日韩| 中文字幕av不卡| 久久久精品日韩欧美| 9人人澡人人爽人人精品| 男人的j进女人的j一区| 亚洲一卡二卡三卡四卡五卡| 国产亚洲精品超碰| 制服丝袜成人动漫| 欧美三级在线看| 欧美日韩在线电影| 欧美日韩高清影院| 国产精品另类一区| 欧美在线一二三| 热久久国产精品| 国产目拍亚洲精品99久久精品| 91在线视频18| 日韩经典一区二区| 久久久精品影视| 欧美性色黄大片手机版| 蜜臀av性久久久久av蜜臀妖精| 337p日本欧洲亚洲大胆精品| av成人免费在线| 香蕉成人伊视频在线观看| 欧美成人乱码一区二区三区| 岛国av在线一区| 天天综合网 天天综合色| 国产午夜精品久久久久久免费视| 一本大道久久精品懂色aⅴ| 奇米精品一区二区三区在线观看| 国产精品丝袜一区| 欧美伦理电影网| 成人激情免费视频| 麻豆精品在线播放| 亚洲欧美日本韩国| 精品国产自在久精品国产| 91网页版在线| 精品系列免费在线观看| 亚洲一区二区三区四区在线观看| 精品久久久久久久久久久久包黑料 | 亚洲色图都市小说| 欧美一级艳片视频免费观看| 高清在线观看日韩| 日韩在线一二三区| 国产精品麻豆久久久| 欧美不卡一区二区三区| 在线视频中文字幕一区二区| 国产福利电影一区二区三区| 日韩二区三区在线观看| 亚洲欧美日韩一区二区| 99热在这里有精品免费|