小编Amo*_*ngh的帖子

请解释一下差异

我有一个关于二维数组的程序

基地是 8678

#include<stdio.h>
#include<conio.h>
main()
{
 int arr[3][3]={
                 {83,8,43},
                 {73,45,6},
                 {34,67,9}
                 };
printf("%d ",&arr+1);  //points to 8696
printf("%d ",arr+1);   //points to 8684
return 0;
}  
Run Code Online (Sandbox Code Playgroud)

arr+1和之间有什么区别&arr+1

c pointers multidimensional-array

5
推荐指数
1
解决办法
912
查看次数

我无法理解这种类型的铸造

我曾经做过型铸造用intchar,但不与指针,所以我张贴了这个问题.

#include <stdio.h>
int main() {
    int a[4] = { 1, 2, 6, 4 };
    char *p;
    p = (char *)a;   // what does this statement mean?
    printf("%d\n",*p);
    p = p + 1;        
    printf("%d",*p);  // after incrementing it gives 0 why?
}
Run Code Online (Sandbox Code Playgroud)

第一次调用printf给出了数组的第一个元素.在p=p+1它给出之后0.为什么?

c arrays pointers type-conversion

2
推荐指数
1
解决办法
222
查看次数

理解C中的递归

这是一个递归程序.但我不明白在这个节目中发生的事件顺序

#include<stdio.h>
count(int);
main() 
{
    int x=5;
    count(x);
}
count(int y)
{
    if(y>0)
    {
        count(--y);
        printf("%d ",y);
    }
}
Run Code Online (Sandbox Code Playgroud)

输出是:

4 3 2 1 0 ...
Run Code Online (Sandbox Code Playgroud)

但是我没有得到第一次count(5)调用时和调用count(4)时会发生什么.控件是否立即进入函数的开头?或者首先打印出值,y然后再次进入函数的开头count()

c recursion function

0
推荐指数
1
解决办法
571
查看次数