i've got to the point when u use structs that has a pointr inside them that points back to the same struct.
i came up with this code but i've got a compile error:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
struct phoenum {
char first_name[7],last_name[12],address[22],tel[11];
struct phoenum *nxt_phoen;
};
void init(struct phoenum *ptr);
//MAIN----------------------------------------------------
void main (void){
struct phoenum *first_phoen;
first_phoen = malloc (sizeof (struct phoenum));
if (first_phoen != NULL)
printf ("malloc ok! %p\n",first_phoen);
printf ("size in byte = %d\n",sizeof (struct phoenum));
init (first_phoen);
}
//End MAIN-------------------------------------------------
void init(struct phoenum *ptr){
ptr->first_name = "Bob";
ptr->tel = "089363106";
ptr->last_name = "Lipman";
printf ("Locations: %p ",ptr->tel);
printf (" %p ",ptr->first_name);
printf (" %p \n ",ptr->last_name);
printf ("last: %p:%s first: %s tel: %s\n",ptr->last_name,ptr->last_name,ptr->first_name,ptr->tel);
}
compile:c(28) : error C2106: '=' : left operand must be l-value.
inside the init function: "ptr->first_name = "Bob";" this cuses the error i've tried useing "*ptr->first_name = "Bob";" (*i belive it's wrong).. allthguo there isn't an error but when i try to print ptr->first_name value i get garbge.

