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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:18:05+00:00 2026-06-01T11:18:05+00:00

I am using visual C++ 6.0 to practice pointer staff, the following is my

  • 0

I am using visual C++ 6.0 to practice pointer staff, the following is my code:

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

typedef struct 
{
    char first_name[50];
    char middle_name[50];
    char last_name[50];
    int height;
    int weight;
}people;

int main()
{
    //declare a people structure pointer
    people *ppl_ptr;

    //allocate memory space for people structure
    ppl_ptr = malloc(sizeof(people));

    //check if you run out of the heap
    if(ppl_ptr==NULL)
    {
        printf("Out of memory!\n");
        return 0;
    }

    //initialize the unname people varible 
    (*ppl_ptr)={"bla","bla","bla",192,58};



    return 0;
}

but I got a syntax error:
C:\C Practice\ch14.c(30) : error C2059: syntax error : '{'
Error executing cl.exe.

and if I replace
(*ppl_ptr)={"bla","bla","bla",192,58};

with something like
(*ppl_ptr).first_name="bla";

I will get a different error:

ch14.c
C:\C Practice\ch14.c(30) : error C2106: '=' : left operand must be l-value
Error executing cl.exe.

and this error msg doesn’t really make sense to me … does this ever occur to anyone of you? Please let me know why it is giving me this error msg. Thanks in Advance.

  • 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-01T11:18:06+00:00Added an answer on June 1, 2026 at 11:18 am

    Try accessing the structure properly:

    char* bla_str_ptr = "bla";
    [...]
    strcpy(ppl_ptr->first_name, bla_str_ptr);
    strcpy(ppl_ptr->middle_name, bla_str_ptr);
    ppl_ptr->height = 123;
    [...]
    

    You could also write an initialization function with this signature:

    void ppl_init(char* first_name, char* middle_name, [...])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just began using Visual Studio to work on a practice .NET project. I
Using static class members in a class is a common practice. consider the following
I have some Visual C++ code that receives a pointer to a buffer with
I'm running Visual Studio '08 and using C# code. I am using forms however,
Using Visual Studio 2008, I created a C++ Win32 project. To release the program,
Using Visual Studio 2005 As per the title; MSDN and google can't tell me,
Using Visual Studio 2005, I wrote a simple DLL in C that uses the
Using visual studio 2008, I had a solution open and realized I need to
(Using Visual Studio 2005 / .NET 2.0) I have a DataSet which is being
Using Visual Studio or Resharper, can I jump to the .aspx page while in

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.