Hello,
I have this structure and I thought I could set the condition if the structure is pointing to a NULL value.
Here is my simple structure for this example:
typedef struct
{
char *name;
char *data;
} details_t;
details_t emp_details [] =
{
{ "peter", "lawyer" },
{ "john", NULL }, /* No data for john */
{ NULL, NULL }, /* Indicates last element in the array */
};
I think I should be increment the emp_details array and dereferencing the pointer to see if it contains a NULL in the first array element. But not sure if I am going in the right direction.
for(i=i; *emp_details; i++)
{
printf("Name: [ %s ] [ %s ]\n", emp_details[i].name, emp_details[i].data);
}