how can i make the data that i input in a function appear in another one?
i got this problem, im doing this homework, i know you guy dont want to do this for me lol but yea, i already like "done" it, it runs, but see, the teacher said that he wanted us to us structures and functions on it, and i did but for some reason it doesnt do what its supposed to, it runs, but for example, i try to put in some data on the first case and when its finally done asking me for the information, it stops instead of sending me back to the menu, this is wat i got so far:
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#define CAP 10
#define SEG 10
#define COD 10
#define COST 10
#define PREC 10
void ingresar();
void revisar();
main()
{
int op;
int cap[CAP];
int miliseg[SEG];
float cost[COST];
float prec[PREC];
char codven[COD];
printf("Programa para capturar datos de la compañia de discos");
printf("\n\nMenu de Opciones: ");
printf("\n1. Ingresar un nuevo articulo al inventario.");
printf("\n2. Revisar los datos del inventario.");
printf("\n3. Salir del programa.");
printf("\n\nFavor de elegir una opcion: ");
scanf("%d", &op);
switch (op)
{
case 1:{
ingresar();
break;
}
case 2:{
revisar();
break;
}
default:{
printf("\n\nOpcion incorrecta.");
break;
}
}
return 0;
}
void ingresar()
{
struct Discos
{
int op;
int cap[CAP];
int miliseg[SEG];
float cost[COST];
float prec[PREC];
char codven[COD];
} discos;
int op;
int cap[CAP];
int miliseg[SEG];
float cost[COST];
float prec[PREC];
char codven[COD];
printf("\nFavor de ingresar los siguientes datos: ");
printf("\n\n\nCapacidad del disco en byte: ");
scanf("%d", &cap[1]);
printf("\nTiempo de acceso en milisegundos: ");
scanf("%d", &miliseg[1]);
printf("\nCodigo del vendedor (A, B, C, D): ");
scanf("%s", &codven[1]);
printf("\nCosto de fabrica: ");
scanf("%f", &cost[1]);
printf("\nPrecio de venta al publico: ");
scanf("%f", &prec[1]);
return;
}
void revisar()
{
printf("\nDatos del inventario.");
printf("\nCapacidad\tTiempo de acceso\tCodigo del vendedor\tCosto de fabrica\tPrecio de venta");
printf("\n\nDiscos.cap\tDiscos.miliseg\tDiscos.codven\tDiscos.cost\tDiscos.prec");
getch();
return ;
}
i just need someone to tell me what i did wrong, theres no need for doing it for me, just tell me wat i did wrong and ill try to fix it, thanks
by the way, sorry its in spanish, i think i forgot to mention some of the info in here, if i forgot to mention anything just tell me and ill try to see if i can fix it, thanks