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 7820513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:19:44+00:00 2026-06-02T07:19:44+00:00

This suppose to be an easy link list problem, but when I add input_info()

  • 0

This suppose to be an easy link list problem, but when I add input_info() to the main() function, MSVC cl compiler gives me error msg like this:

syntax error : missing ';' before 'type'
error C2065: 'first_ptr' : undeclared identifier
warning C4047: 'function' : 'struct linked_list *' differs in levels of indirection from 'int '
warning C4024: 'print_list' : different types for formal and actual parameter 1

I don’t understand why compiler is showing me error like this… Please let me learn about why MSVC 6.0 compiler is giving me error msg like this.

/*
*
*     this program is a simple link list which will have add(), 
*   remove(), find(), and tihs link list will contains the student 
*   information. 
*         
*/

#include <stdlib.h>
#include <stdio.h>

//this ppl structure student holds student info
typedef struct 
{

    char *name;
    int height;
    int weight;

}ppl;

//this structure is the link list structure
typedef struct linked_list
{
    ppl data;
    struct linked_list *next_ptr;
} linked_list;

//this function will print the link list in a reversed order
void print_list(linked_list *a)
{

    linked_list *llp=a;
    while (llp!=NULL)
    {
    printf("name: %s, height: %d, weight: %d \n",llp->data.name,llp->data.height,llp->data.weight);
        llp=llp->next_ptr;

    }
}

//this function will add ppl info to the link list
void add_list(ppl a, linked_list **first_ptr)
{
    //new node ptr
    linked_list *new_node_ptr;
    //create a structure for the item
    new_node_ptr=malloc(sizeof(linked_list));

    //store the item in the new element
    new_node_ptr->data=a;
    //make the first element of the list point to the new element
    new_node_ptr->next_ptr=*first_ptr;

    //the new lement is now the first element
    *first_ptr=new_node_ptr;
 }

void  input_info(void)
{
    printf("Please input the student info!\n");
}


int main()
{   
    ppl a={"Bla",125,11};

    input_info();
    //first node ptr
    struct linked_list *first_ptr=NULL;

    //add_list(a, &first_ptr);
    printf("name: %s, height: %d, weight: %d \n",a.name,a.height,a.weight);

    //print link list
    print_list(first_ptr);  
    return 0;
}
  • 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-06-02T07:19:45+00:00Added an answer on June 2, 2026 at 7:19 am

    Since you’re comiling in MSVC which is strictly C89, you can’t mix declarations, and code, so

    input_info();
    struct linked_list *first_ptr=NULL;
    

    Doesn’t work, since after input_info(); The compiler sees a type, which it shouldn’t, since you can’t declare anything there. Simply change that to:

    struct linked_list *first_ptr=NULL;
    input_info();
    

    And everything should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I suppose this could apply to any dynamic language, but the one I'm using
Particularly the bit about live.... jQuery('.something').live('click', function() { jQuery(this).parent('form').reset(); }); I suppose this might
This code is suppose to add an onClick event to each of the a
This is probably a silly and easy question, but it seems sometimes the simplest
I am new to using QT so I suppose this has an easy answer
This is probably an easy question, but hey, i'm a beginner. So I've created
I suppose that a program like this... class Test { public static void main(String[]
Short and easy question, but I seem to have a writer's block here: Suppose
Pretty straight forward I suppose. Getting the background position is easy, but just getting
This questions seems easy, but I am not able to understand the real work

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.