#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Funcs.h"
int main()
{
info **stru;
info charlie;
int el=0;
int allo=0;
int count=0;
while(*charlie.Name!='}'){
charlie=getstuff(&allo,&el);
Add(&charlie,stru,&allo,&el);
}
love(stru, &el);
system("PAUSE");
return 0;
}
typedef struct info{
char *Name;
char *Address;
char *Loc;
int zip;
}info;
void love(info**,int*);
info getstuff(int*, int*);
void Add(info*, info**, int*, int*);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include"Funcs.h"
void love(info **zips,int *length){
info thing=**zips;
// printf("%s\n",thing.Name);
int c=0;
char *n;
char *a;
char *l;
int z;
for(c=0;c<=(*length);c++){
thing=*zips[c];
n=thing.Name;
a=thing.Address;
l=thing.Loc;
z=thing.zip;
//printf("%s \n",n);
// printf("%s \n",a);
//printf("%s \n",l);
//printf("%d \n",z);
}
}
info getstuff(int *allocated,int *element){
info Anon;
Anon.Name=malloc(40*(sizeof(char)));
Anon.Address=malloc(60*(sizeof(char)));
Anon.Loc=malloc(40*(sizeof(char)));
fgets(Anon.Name,60,stdin);
if(strlen(Anon.Name)<3)
fgets(Anon.Name,60,stdin);
fgets(Anon.Address,60,stdin);
fgets(Anon.Loc,60,stdin);
scanf("%d",&Anon.zip);
return Anon;
}
void pushstuff(int n, info **list){
}
void Add( info *object, info **thearray, int *alloc, int *ele )
{
printf("%s \n %s \n %s \n %d ",*object);
if ( (*alloc) <= 50)
{
(*alloc)++;
}
else
{
printf( "50 max! \n" );
return;
}
*thearray = (info*)realloc(*thearray,(*alloc) * (sizeof(info)));
printf("ELEMENT %d \n",(*ele));
printf("ARRAY %d \n",*thearray[*ele]);
*thearray[(*ele)] = *object;
(*ele)++;
}
thanks in advance!


Sign In
Create Account

Back to top









