Does C have an equivalent to Pascals with statement?
Submitted by: AdministratorNo. 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;
Submitted by: Administrator
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;
Submitted by: Administrator
Read Online C Programming Job Interview Questions And Answers
Top C Programming Questions
☺ | Why does this code crash? |
☺ | What is wrong with this declaration? |
☺ | How can I read/write structures from/to data files? |
☺ | What does static variable mean in c? |
☺ | How can I increase the allowable number of simultaneously open files? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |