Trying to figure out how to get this program to work, its suppose to prompt the user for the data then list the users data but for some reason is not compiling properly.

#include <stdio.h> 


typedef struct
{
int data;
char firstName[30];
char lastName[30];
char street[35];
char city[20];
char state[3];
int zip;
char phone[15];
int accountId;
} Customer[10];


void insert(Customer list[], int size );
void search(void);

int i = 0;

void main()
{
const int size = 2; 
Customer list[size]; 
insert( list, size );
search( void ); 

}

char find_customer(void)
{
int i;

for (i = 0; i < Customer; i++)
if ( Customer[i].state == state )
return i;
return -1;
}


void insert(Customer list[], int size )
{

printf("Please enter the Customer information:\n"); 

for(i = 0; i < 2 ;i++)
{ 
printf("\Enter Data for Customer:"); 
scanf("%S",&list[i].data); 

printf("\Enter First Last Phoner:"); 
scanf("%S %S %S",&list[i].firstName, &list[i].lastName,&list[i].phone); 

printf("\Enter Address (Street City State ZIP):"); 
scanf("%S %S %S %U ",&list[i].street, &list[i].city, &list[i].state, &list[i].zip ); 

} 

}

void search(void)
{

int i, state;
printf(" Enter a state: ");
scanf("%S", &state);
i = find_customer(state);
if (i >= 0) {
printf(" name: %s\n", Customer[i].firstname);

}

post some of the error messages.

Function Search() -- Is state supposed to be one of the 50 USA states? If yes, then it can not be an integer, but must be 2 character array followed by a null terminator (total of 3 characters). If not, then you need to define what "state" is so that whoever is using your program will know.

The argument to scanf() is wrong for an integer -- it should be "%d", not "%S".

post some of the error messages.

Function Search() -- Is state supposed to be one of the 50 USA states? If yes, then it can not be an integer, but must be 2 character array followed by a null terminator (total of 3 characters). If not, then you need to define what "state" is so that whoever is using your program will know.

The argument to scanf() is wrong for an integer -- it should be "%d", not "%S".

"Some" error messages! The OPs code is riddled with errors:
@OP
- void main (use int main(void) if command line args aren't required)
- use of %S (for wide char formats) instead of %s in scanfs
- declares function prototypes for some functions but not for others
- numerous scoping errors with regards to the type defined by the data structure - references to the "list" in functions, but the list isn't being passed.
- incorrect typedef for Customer (not Customer[10])
- magic number of 2 (for the size - declares it but doesn't use it)
- that'll do for now (phew!)

This assignment has a peculiar ring to it:
http://www.daniweb.com/forums/thread207898.html
Are these guys in the same class??;)

Very certain he could be taken the same course, its distance learning, and with that said distance learning + accelerated courses + summer = not enough time! I figure in a lecture setting I would be asking my peers for help, this being an online course that makes you my peers wether you like it or not :-O I am referencing this as a source though so no worries.

This article has been dead for over six months. Start a new discussion instead.