Search Results

Search found 1 results on 1 pages for 'newbdeveloper'.

Page 1/1 | 1 

  • c++ tables of unions and structures

    - by newbDeveloper
    I was told to write a program, that creates a union and structure, then creates two-element arrays of unions and structures and fills their fields. I have created a union and a structure, but how to fill their fields in arrays ? #include <iostream> #include <stdlib.h> #include <stdio.h> using namespace std; union complex; union complex{ int i1; long double ld1; } u; struct Person { char* name; int age; bool sex; void show(){ printf("name %s, age %2.0d, sex %1d\n", name , age, sex); }; } person; int main(void) { Person *o = new Person[2]; complex *un = new complex[2]; un[0]->i1=i; system("pause"); return 0; } I've tried un[0]-i1=i; but it's not the proper way to do this.

    Read the article

1