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

  • Home
  • SEARCH
  • 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 6704949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:20:50+00:00 2026-05-26T07:20:50+00:00

This is what I am trying to do: I have been working on code

  • 0

This is what I am trying to do:

I have been working on code that I have create a structure (hard coded in main) Then I want to malloc space for two structs (tryin to use functions). Then copy all the data in the first struct to the second struct and print the new structure.

The errors the occur is:
I don’t understand what this error means.

pointer.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pointer.c:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token



#include <stdio.h>
#include <stdlib.h>
#include "pointer.h"
int rec = 0;

line 7

struct emp *create(int record){
emp *new_employees = malloc(sizeof(info) * (record+1));

return new_employees;   
}

line 13

struct emp *copy(emp *data, int record){
emp *new_employee = create(record+1);
int i;
for(i = 0; i<record;i++){
    new_employee.first = data.first;
    new_employee.last = data.last;
    new_employee.start_date = data.start_date;
    new_employess.sal = data.sal;
    data++;
}
return new_employee;
}


int main(void){
struct info employees;
employees.first = "FIRST";
employees.last = "LAST";
employees.start_date = "June-20th-2006";
employees.sal = 55555.55;
rec = rec+1;



}

header file:

#include <string.h>
struct info {
char *first;
char *last;
char *start_date;
float sal;
} emp;
  • 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-26T07:20:51+00:00Added an answer on May 26, 2026 at 7:20 am

    info is not a type, and emp is just a variable of type struct info. Either add a typedef (if you want to emp as a type):

    typedef struct info {
        char *first;
        char *last;
        char *start_date;
        float sal;
    } emp;
    

    …or add a struct keyword.

    struct info *create(int record);
    struct info *copy(emp *data, int record);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on this problem for a while now. I am trying
I have been working on this for 24 hours now, trying to optimize it.
I have been trying to make this to be a little jQuery plugin that
I'm trying to create a custom module using Magento's EAV structure and have been
Hello Guys! I have been trying to create a simple sample code for my
Is there anyone who knows this? I have been trying this for the last
I have been trying to get around this error for a day now and
I have been trying to tackle this problem , but I am having difficulty
I have been trying to get this one section of my UI to immediatly
I have been trying to figure this out for way to long tonight. I

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.