pointers

    8热度

    4回答

    我新手上C.我需要了解每个印刷在屏幕上的值的装置通过以下代码: #include<stdio.h> int main() { int x = 10; int *ptr = &x; printf("%d %d %d\n", *ptr,**&ptr, 2**ptr); return 0; } 输出(GCC): 10 10 20 这里,我已声明变量

    1热度

    1回答

    int* dividers_of(int x, int ammount){ int i,j = 1; int* dividers = (int*)calloc(ammount,sizeof(int)); /* calloc initializes int array to 0!*/ for(i=0;i<ammount;i++){ while((x%j) != 0){

    1热度

    1回答

    int main() { srand(time(NULL)); Card c; Card *Pc; Pc = new Card [52]; Card ** someHands; // typedef Card * Hand; // Hand *someHands; CardtoArray(c,Pc); pri

    0热度

    1回答

    我试图做一个程序,对于给定的int value保持分隔量的数组: int amount_of_dividers和那些分隔的列表:int* dividers 这是代码: #include <stdio.h> #include <stdlib.h> typedef struct{ int value; int amount; int* dividers; } Di

    4热度

    3回答

    我刚刚在a coursera lecture的分钟1:06提出了这段代码。它有什么作用? int (*cmp)(char*, char*);

    0热度

    1回答

    我想使一些成功的二维动态字符串数组,但由于某种原因两个int变量,这实际上是行数(指针数组)和大小(可以多久),变成一个神秘的价值。 #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> void write (char ***p, int size_r, int size_c) {

    0热度

    1回答

    我只是想知道,在一个链表是什么两者之间的区别: node1 = node2 和 node1->next = node2 第一行让我有点困惑。

    0热度

    1回答

    当我输入两个矩阵时,结果矩阵不显示正确的答案,是我的算法错误还是我不应该以这种方式使用指针? 请帮忙! main() { int a[3][3],b[3][3],c[3][3],*p[3],*q[3],*r[3],j1=0; // 1st Matrix for(int i=0;i<3;i++){ for(int j=0;j<3;j++){

    -2热度

    1回答

    我有这个类: class A{ template<typename Type = int32_t> Type b(){} template<typename Type = int32_t> Type b(Type a, Type b){} } 而且我想获得一个指针的函数b<int>()和b<int>(int, int) 我试过,但它不知道哪个一个接: auto t = (

    0热度

    1回答

    如何使用新建立当前班级的副本? 我试过 Sample* pointerToSample = new this; 有人可以解释我该怎么做吗?