Can someone guide me how can I use scanf for a structure?
const int IDLEN = 30;
const int POLARITYLEN = 3;
const int MAXSTOCKITEMS = 10;
struct TransistorRec {
char manufacturersID[IDLEN];
char polarity[POLARITYLEN];
float power;
float gain;
int stock;
};
typedef struct TransistorRec Transistor;
struct StockRec{
int size;
Transistor stocklist[MAXSTOCKITEMS];
};
typedef struct StockRec Stock;
#include "stdio.h"
int main()
{
printf("Enter manufacturer's ID, polarity, power, gain, stock ");
scanf("%c %c %f %f %i",TransistorRec.manufacturersID[0],TransistorRec.polarity[0],TransistorRec.power[0],TransistorRec.gain[0],TransistorRec.stock[0]);
return 0;
}