[LCP]passing struct to function
Carlos Pruitt, Jr.
cept at bellsouth.net
Sun Nov 21 08:43:02 UTC 2004
I am trying to find what I am doing wrong. This program compiles with
the warning message:
warning: passing arg 1 of `print_mailing_list' from incompatible pointer
type
When I run the program, the output is:
f at carlos
#include <stdio.h>
#include <string.h>
struct mailing
{
char first_name[60];
};
void print_mailing_list(struct mailing *mlist)
{
printf("%s\n", mlist->first_name);
}
int main()
{
struct mailing list =
{
"carlos"
};
struct mailing *list_ptr;
if (strcmp(list.first_name, "carlos") == 0)
print_mailing_list(&list_ptr);
return 0;
}
--
Carlos E. Pruitt, Jr.
cept at bellsouth.net
Oliver's Law:
Experience is something
you don't get until just
after you need it.
More information about the linuxCprogramming
mailing list