//Question-1
#include<iostream>
#include<thread>
using namespace std;
int x=0;
void fun() {
for (int i=0;i<1000;++i){
x++;
}
}
int main(){
thread t1(fun);
thread t2(fun);
t1.join();
t2.join();
cout << x; //Why 2000 everytime
}
//Question-2
int main() {
int s = 1;
char *p = (char*)&s;
cout << (int)*(p+1); //Why 0 everytime
}
//Question-3: value of *c on Big Endian system and why?
int main(){
unsigned int i = 1;
char *c = (char*)&i;
if (*c)
cout << "Little Endian";
else
cout << *c; //What it will print on Big endian system
}