Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Wykład_06.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int tabT[3][2];
- //int** ptr = tabT;
- int** tabD = new int*[3];
- tabD[0] = new int[2];
- tabD[1] = new int[2];
- tabD[2] = new int[2];
- // ========================================
- int wrt = 10;
- typedef int LICZBA_CALKOWITA;
- LICZBA_CALKOWITA val1;
- val1 = 10;
- cout << sizeof(int) << "\t" << sizeof(LICZBA_CALKOWITA) << endl;
- typedef int MY_TAB[3];
- MY_TAB testTab;
- testTab[0] = 10;
- MY_TAB testTab2[5];
- LICZBA_CALKOWITA* ptr1 = &val1;
- MY_TAB* ptr2 = &testTab;
- // ==============================================
- union MyUnion {
- int myInt;
- char myChar;
- };
- MyUnion myunion;
- myunion.myInt = 500;
- cout << ">" <<myunion.myInt << "<" <<endl;
- cout << ">" << (int)myunion.myChar << "<" << endl;
- struct MyStruct {
- int myInt;
- char myChar;
- bool equal(MyStruct* ptr) {
- return ptr->myChar == myChar && ptr->myInt == myInt;
- }
- };
- MyStruct mystract;
- mystract.myChar = 'a';
- mystract.myInt = 10;
- MyStruct* ptr3 = new MyStruct();
- ptr3->myChar = 'a';
- ptr3->myInt = 10;
- MyStruct* ptr4 = new MyStruct();
- ptr4->myChar = 'a';
- ptr4->myInt = 10;
- cout << (mystract.equal(ptr4)) << endl;
- cout << (ptr3->equal(ptr4)) << endl;
- class MyClass {
- public:
- int myInt;
- char myChar;
- };
- MyClass myclass;
- cout << sizeof(MyStruct) << "\t" << sizeof(MyClass)<< endl;
- //cout << mystract.myInt << "\t" << myclass.myInt << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement