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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:00:32+00:00 2026-06-15T22:00:32+00:00

I’ve got following code fragment and I want to know if it is pure

  • 0

I’ve got following code fragment and I want to know if it is pure C or it contains some C++ elements. This question stems from the fact that I think it is only C, but some compilers don’t accept the code.

   // User struct derived from FunctionBlock
    struct Function{
        // Inputs
        int codeGenerationIterator;
        int i;
        char* s;
        // Outputs
        // Internal
    };
    void FunctionCall(struct Function *arg){
    }
    void FunctionConstructor(struct Function *arg){
        arg->i=3;
        arg->s="!";
        // Call constructor for all not primitive variables
        // Create struct with first call
        FunctionCall(arg);
    }
    // User type definition
    typedef struct Punto{
        int codeGenerationIterator;
        Function x[3+1];
            Function *x_pointer[3+1];
        double y;
    };
    void PuntoConstructor(struct Punto *arg){
        // Call constructor for all not primitive variables
        for(arg->codeGenerationIterator=0;arg->codeGenerationIterator<=3;arg->codeGenerationIterator++){
            arg->x_pointer[arg->codeGenerationIterator]=&(arg->x[arg->codeGenerationIterator]);
            FunctionConstructor(arg->x_pointer[arg->codeGenerationIterator]);
        }
    }
    // User type definition
    typedef struct Cerchio{
        int codeGenerationIterator;
        double r;
        Punto centro;
            Punto *centro_pointer;
    };
    void CerchioConstructor(struct Cerchio *arg){
        // Call constructor for all not primitive variables
            arg->centro_pointer=&(arg->centro);
        PuntoConstructor(arg->centro_pointer);
    }
    // User type definition
    typedef struct Container{
        int codeGenerationIterator;
        Cerchio circonferenza[10+1];
            Cerchio *circonferenza_pointer[10+1];
    };
    void ContainerConstructor(struct Container *arg){
        // Call constructor for all not primitive variables
        for(arg->codeGenerationIterator=0;arg->codeGenerationIterator<=10;arg->codeGenerationIterator++){
            arg->circonferenza_pointer[arg->codeGenerationIterator]=&(arg->circonferenza[arg->codeGenerationIterator]);
            CerchioConstructor(arg->circonferenza_pointer[arg->codeGenerationIterator]);
        }
    }

    int main(void){

        // Variable definitions
        int codeGenerationIterator;
        int count;
        Punto insiemePunti[50+1];
            Punto *insiemePunti_pointer[50+1];
        Cerchio cerchio;
            Cerchio *cerchio_pointer;
        Container container;
            Container *container_pointer;
        Container containers[11+1];
            Container *containers_pointer[11+1];
        // Call constructor for all not primitive variables
        for(codeGenerationIterator=0;codeGenerationIterator<=50;codeGenerationIterator++){
            insiemePunti_pointer[codeGenerationIterator]=&insiemePunti[codeGenerationIterator];
            PuntoConstructor(insiemePunti_pointer[codeGenerationIterator]);
        }
            cerchio_pointer=&cerchio;
        CerchioConstructor(cerchio_pointer);
            container_pointer=&container;
        ContainerConstructor(container_pointer);
        for(codeGenerationIterator=0;codeGenerationIterator<=11;codeGenerationIterator++){
            containers_pointer[codeGenerationIterator]=&containers[codeGenerationIterator];
            ContainerConstructor(containers_pointer[codeGenerationIterator]);
        }

        container.circonferenza[1].centro.x[0].i=2;
        containers[2].circonferenza[2].centro.x[4].i=2;

    printf("Works!");
    getchar();getchar(); // TODO: delete
    return 0;
    }

As you can see I haven’t use classes or overloading but only simple instructions, structs and some pointers. So, why do some strict C compilers give me an error?

  • 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-15T22:00:32+00:00Added an answer on June 15, 2026 at 10:00 pm

    No, this is not valid C. This line:

        Function x[3+1];
    

    lacks the struct keyword, and there’s no typedef struct Function Function; to introduce the type alias you seem to be using.

    Also, the use of // comments requires a recent-enough compiler, that syntax wasn’t added to C officially until C99. An older compiler would fail for this reason, too.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
Does anyone know how can I replace this 2 symbol below from the string
I have this code to decode numeric html entities to the UTF8 equivalent character.
I know there's a lot of other questions out there that deal with this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace

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.