Passing the value to the function Problem
In "Code" function, How can i get the count value from the main program?
Cheers
Code:
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<stdlib.h>
void sortarray(struct manufacturer manu[],int length);
void code(struct manufacturer manu[],int length, struct count c);
//************prototype******************
struct manufacturer
{
char code[5];
char name[16];
char address[21];
char contact[11];
int position;
};
struct count
{
int i;
};
//*********m a i n *****************
int main(void)
{
struct manufacturer man[10];
struct count ct;
int i;
for(ct.i=0;ct.i<10;ct.i++)
{
printf("position main: %d\n",ct.i);
code(man,6,ct);
}
return(0);
}
//**************function****************
void code(struct manufacturer manu[],int length, struct count c)
{
printf("Position outside: %d\n",manu[c.i].position);
puts("Enter Code ");
gets(manu[c.i]. code);
}