相关疑难解决方法(0)

scanf到struct不起作用

我有这个功能,我需要得到一个结构的坐标.这些是结构:
// --------- STRUCTURES ----------

typedef struct coordinates  
{
    int x_l;
    int y_l;
    int x_r;
    int y_r;
} Coordinates;

typedef struct field 
{
    char Id;
    Coordinates location;
    int area;
    int price;
} Field;
Run Code Online (Sandbox Code Playgroud)

这是功能:

Field GetFieldFromUser(int cptr,Field *pf1)
{       
    //Field *pf
    int i=0;

    printf("\nPlease enter information for your new field:\n");
    printf("the Id of the field is 5 digit num between 00000-99999:\n");
    printf("The Id of the Field given Automatic by the system\n");


    pf1->Id= 0000+cptr;

    printf("\nThis is the ID for the new …
Run Code Online (Sandbox Code Playgroud)

c struct scanf

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

标签 统计

c ×1

scanf ×1

struct ×1