Groups | Search | Server Info | Login | Register
Groups > comp.lang.c.moderated > #415
| From | galois271@gmail.com |
|---|---|
| Newsgroups | comp.lang.c.moderated |
| Subject | "warning: assignment from incompatible pointer type [enabled by default]" |
| Date | 2013-01-04 18:14 -0600 |
| Organization | Usenet Fact Police |
| Message-ID | <clcm-20130104-0001@plethora.net> (permalink) |
Any help here would be GREATLY appreciated! Thanks!!!
Here is my compiler response:
"gcc "./Desktop/C Programs/HeadFirstTests.c" -o "./Desktop/C Programs/HFT" && "./Desktop/C Programs/HFT"
./Desktop/C Programs/HeadFirstTests.c: In function ‘addFirst’:
./Desktop/C Programs/HeadFirstTests.c:40:16: warning: assignment from incompatible pointer type [enabled by default]
./Desktop/C Programs/HeadFirstTests.c: In function ‘printList’:
./Desktop/C Programs/HeadFirstTests.c:51:7: warning: assignment from incompatible pointer type [enabled by default]
"
/* This program builds
a basic linked list.
gcc "./Desktop/C Programs/HeadFirstTests.c" -o "./Desktop/C Programs/HFT" && "./Desktop/C Programs/HFT"
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct { // Define a linked list node
char *name;
struct LLNODE *next;
}LLNODE;
void addFirst(char *data); //Declare function prototypes
void printList(void);
LLNODE *head = NULL; //Defind global pointer variable head
int main(int argc, char *argv[])
{
addFirst("Johnson");
addFirst("Robert");
addFirst("Jerimiah");
printList();
return EXIT_SUCCESS;
}
void addFirst(char *data)
{
LLNODE *newNode;
newNode = malloc(sizeof(LLNODE));
newNode->name = data;
newNode->next = head; //Keep getting errors here.
head = newNode;
}
void printList(void)
{
LLNODE *itr = head;
while(itr != NULL)
{
printf("%s\n", itr->name);
itr = itr->next; //Keep getting errors here.
}
}
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Back to comp.lang.c.moderated | Previous | Next — Next in thread | Find similar
"warning: assignment from incompatible pointer type [enabled by default]" galois271@gmail.com - 2013-01-04 18:14 -0600 Re: "warning: assignment from incompatible pointer type [enabled by default]" "LeJacq, Jean Pierre" <jeanpierre.lejacq@quoininc.com> - 2013-02-26 10:48 -0600 Re: "warning: assignment from incompatible pointer type [enabled by default]" espie@lain.home (Marc Espie) - 2013-02-26 10:51 -0600 Re: "warning: assignment from incompatible pointer type [enabled by default]" Barry Schwarz <schwarzb@dqel.com> - 2013-02-26 10:47 -0600 Re: "warning: assignment from incompatible pointer type [enabled by default]" Jasen Betts <jasen@xnet.co.nz> - 2013-02-26 10:51 -0600 Re: "warning: assignment from incompatible pointer type [enabled by default]" Andrei Voropaev <avorop@mail.ru> - 2013-02-26 10:51 -0600 Re: "warning: assignment from incompatible pointer type [enabled by default]" gordonb.zh6m9@burditt.org (Gordon Burditt) - 2013-02-26 10:51 -0600
csiph-web