Does C have an equivalent to Pascals with statement?

Latest questions Forums Assignment Help Does C have an equivalent to Pascals with statement?

This topic contains 1 reply, has 1 voice, and was last updated by  Aakanksha 2 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1110

    Aakanksha
    Participant

    Does C have an equivalent to Pascals with statement?

    #9672

    Aakanksha
    Participant

    No. The way in C to get quick and easy access to the fields of a structure is to declare a little local structure pointer variable (which, it must be admitted, is not quite as notationally convenient as a with statement and doesn’t save quite as many keystrokes, though it is probably safer). That is, if you have something unwieldy like

    structarray[complex_expression].a =

    structarray[complex_expression].b +

    structarray[complex_expression].c;

    you can replace it with

    struct whatever *p = &structarray[complex_expression];

    p->a = p->b + p->c;

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.