That's the task (should use copy by value semantics):
Code:
typedef struct {
  // street address
  char street[30];
  // postal code
  int postalCode;
} Address;

/*
 * This function creates a new address with a certain street address
 * and a certain postal code.
 */
Address addressConstruct(const char *street, int postalCode);
// Accessor for the street address. The caller
// of this function must free() the return value when
// he/she is done with it!
char *addressGetStreet(Address addr);
Here is my implementation
Code:
Address addressConstruct(const char *street, int postalCode)
{
	Address add;

	strcpy(add.street, street);
	add.postalCode = postalCode;

	return add;
}
char *addressGetStreet(Address addr)
{
	char* ch;
	
	ch = (char*)malloc((strlen(addr.street)+1)*sizeof(char));
	strcpy(ch, addr.street);
	
	return ch;
}
Could someone tell me how to use DevC++ to detect memory leaks?
Thanks in advance.