小编afi*_*ser的帖子

"不兼容的指针类型"在C中编译

我的代码

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

void getData(short int *number, char *string)
{
    printf("\nPlease enter a number greater than zero: ");
    scanf("%hd", number);

    printf("Please enter a character string: ");
    scanf("%s", string);
}

void echoPair(short int *number, char *string)
{
    printf("Number: %hd Character(s): %s\n", *number, string); 
}

int main()
{
    short int *number = 0;
    char string[32] = {0};

    printf("This program will ask you to enter a number greater than zero and \na character string with less than 32 characters …
Run Code Online (Sandbox Code Playgroud)

compiler-construction pointers character short compiler-warnings

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