Re: passing a pointer to a struct to a function that uses ncurses
- From: "A. Sinan Unur" <1usa@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 13:23:57 GMT
mark.e.nelson@xxxxxxxxx wrote in news:1143805978.415339.184090
@j33g2000cwa.googlegroups.com:
run.c
#include "myform.h"
#include <string.h>
#include <malloc.h>
malloc.h is non-standard, use stdlib.h.
int main()
int main(void) is better.
{
form_data data;
You have already declared data here to be of type form_data. This has
already allocated space for data.
char *name = "Mark Nelson\0";
char *address = "1 Main Road\0";
Why the \0's at the end?
// data = (form_data) calloc(1, sizeof(form_data));
Why is this line here? Is it commented out in the code that crashes?
strcpy(data.name, name);
strcpy(data.address, address);
struct form_data data = { "Mark Nelson", "1 Main Road" };
The rest is platform-dependent stuff which you might want to take a Unix
related group maybe.
Sinan
--
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(remove .invalid and reverse each component for email address)
.
- References:
- passing a pointer to a struct to a function that uses ncurses
- From: mark . e . nelson
- passing a pointer to a struct to a function that uses ncurses
- Prev by Date: Re: size in kbytes?
- Next by Date: Copying fread behaviour on char array
- Previous by thread: passing a pointer to a struct to a function that uses ncurses
- Next by thread: Re: passing a pointer to a struct to a function that uses ncurses
- Index(es):
Relevant Pages
|