Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3692768
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:18:00+00:00 2026-05-19T04:18:00+00:00

I have written this piece of code here and I have linked it alright

  • 0

I have written this piece of code here and I have linked it alright with a couple of other functions and a main and it is working no problem and compiling without warnings (I am using the gcc compiler).

I use an array of pointers (archive.products[]) as an entrance point to multiple lists of strings. I’m still at the beginning so the lists have only one node each.

The problem I’ve got is that I can’t get the function lprintf to show on screen the components of the one-node lists of strings I have created. Note that the printf located inside the push function prints alright. So I know that push is doing it’s job…

If anyone has any idea about what might I be doing wrong please drop a reply below.
Thank-you in advance!

#define line_length 61
#define max_products 10

struct terminal_list {
  char terminal[line_length];
  struct terminal_list *next;
}*newnode, *browser;
typedef struct terminal_list tlst;

struct hilevel_data {
 char category[line_length];
 tlst *products[max_products];
};
typedef struct hilevel_data hld;

void import_terms(FILE *fp, hld archive){
  char buffer[line_length];
  char filter_t[3] = "}\n";
  int i = 0, j = 0;

  while (!feof(fp)) {    
    fgets(buffer, line_length, fp);
    if (strcmp(buffer, filter_t) == 0) {
      return;
    }

    head_initiator(archive, i);
    push(buffer,archive, i);

    lprintf();

    i++;
  }
}

void head_initiator(hld archive, int i){
  browser = NULL;
  archive.products[i] = NULL;
}

void push(char buffer[],hld archive, int i){
 newnode = (tlst *)malloc(sizeof(tlst));
 strcpy(newnode->terminal, buffer);
//  printf("%s", newnode->terminal);
 archive.products[i] = browser;
 newnode->next = browser;
 browser = newnode;
}

void lprintf(){
  tlst *p;
  p = browser;
  if (p = NULL){
    printf("empty\n");    
  }
  while(p!=NULL){
    printf("%s\n", p->terminal);
    p=p->next;
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:18:01+00:00Added an answer on May 19, 2026 at 4:18 am

    On : void lprintf()

    if (p = NULL)
    

    should be

    if (p == NULL)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written this code outside all functions: int l, k; for (l =
I have this piece of code written in jQuery and PHP: <script type=text/javascript> $(document).ready(function(){
I have written this piece of objective-c code for playing a video after touching
i have written a small piece of code. This code first blocks the {SIGSEGV},
I have written a small piece of code: System out = null; out.out.println(Hello); This
I have written this code inside a servlet to delete certain records from three
I have written this code in JavaScript and works perfectly fine when I include
I have written this code what it does is if user types postcode or
Here's a piece of code that I've written to check if the sum of
Here's an interesting architectural query. I have a piece of code that needs to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.