#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int i=0,menu;
typedef struct _Person
{
char name[10] ;
int tele;
}Person;
void add(Person *pp[i]) // I want to edit the struct's name
{
char aa[10];
printf("Enter name : ");
scanf("%s",pp[i]->name); //struct pointer's name dynamic memory gets string
}
int main()
{
Person *pp[3];
for(int j=0; j<3; j++)
{
pp[j] = malloc(sizeof(struct _Person)); //
}
printf("Select menu \n1.add tele 0. exit\n");
scanf("%d", &menu);
while( menu != 0)
{
switch( menu )
{
case 1: add(?????????); i++; break; // call add FUNC
}
printf("Select menu \n1.add tele\n");
scanf("%d", &menu);
}
for(int j=0; j<3; j++)
printf("%s %s %s", pp[j]->name); // Then I wanna show the stings in here...
}
我想制作一种电话簿! 所以试图在结构指针中构造结构样式的内存 但是我不知道该把参数放在添加FUNC中并使代码添加部分....;(((请帮助我..
答案 0 :(得分:0)
只需将当前条目传递给您的添加功能
{
"count": 18,
"next": "http://127.0.0.1:8008/api/qacommission/?ref=60&page=2",
"previous": null,
"results": [
{
"id": 1,
"price": 20.0,
"pct": 0.1,
"commission": 2.0,
"status": 1,
"user": 7,
"ref": 60
},
{
"id": 2,
"price": 10.0,
"pct": 0.1,
"commission": 1.0,
"status": 1,
"user": 7,
"ref": 60
},
......
......
......
{
"id": 10,
"price": 15.0,
"pct": 0.1,
"commission": 1.5,
"status": 1,
"user": 7,
"ref": 60
}
]
}
和
resnet50