C语言-指针,

来源:互联网 发布:淘宝网儿童合唱演出服 编辑:程序博客网 时间:2024/06/07 19:03

初学C语言,以下是我的学习比较,有错误以后更正。

指针:理解两个符号的定义是关键。

&:gives the address of an object,

*:The unary operator * is the indirection or dereferencing operator; when applied to a pointer, it accesses the object the pointer points to.

int *p; 其实就是p指向的对象是int类型。

Since C passes arguments to functions by value, there is no direct way for the called function to alter a variable in the calling function.

C语言并不像JAVA一直传参的过程改变自身的值。C语言传递的参数是自己的副本。那么如何传递参数本身呢?

void swap(int *px, int *py)

这个时候函数里面的参数,我会感到迷惑,参数是*px吗?仔细想想不是,应该是指针px.     注: int *px 申明指针   *px = a 指针取值运算   px = &a 指针赋值运算。


C语言编译:

a stack is a data structure where values can be added or deleted, but only according to a “last-in, first-out” discipline. A stack can be implemented as an array, where we always insert and remove elements from one end of the array. This end is called the top of the stack. With IA32, the program stack is stored in some region of memory. the stack grows downward such that the top element of the stack has the lowest address of all stack elements. The stack pointer %esp holds the address of the top stack element. 




0 0