Untitled
Anonymous
Plain Text
09/09/2025 7:50 AM
1.8 KB
22
Indexable
Never
/*#include<iostream>
#include<limits>
int main(void) {
int x = 0;
double y = 3.5;
//x = int(1.5);
//x = (int)1.5;
x = static_cast<int>(1.5);
x = y;
std::cout << x << std::endl;
return 0;
}*/
/*#include<iostream>
#include<limits>
int main(void) {
int x = 10;
int *p;
p = &x;
//ampersand gets x address
//*p = 17;
//*pointer_name
std::cout << x << std::endl;
std::cout << *p << std::endl;
return 0;
}*/
/*#include<iostream>
#include<limits>
int main(void){
int x = 10;
void *p = static_cast<void*>(&x);
int *pi = static_cast <int*>(p);
std::cout << *p << std::endl;
void v;
int *p = nullptr;
double *q = nullptr;
auto r = nullptr;
return 0;
}*/
/*#include<iostream>
#include<limits>
int main(void) {
int *p = nullptr;
for (...) {
p = new int{123};
}
p = new int{123};
std::cout << *p << std::endl;
delete p; //always delete after new
return 0;
}*/
/*#include<iostream>
#include<limits>
int main(void) {
int x = 10;
int &r = x;
r++;
std::cput << x << std::endl;
return 0;
}*/
/*#include<iostream>
#include<limits>
int main(void) {
// int b = 0;
// int const c = b;
constexpr int b = 10;
constexpr int c = b+10;
std::cout << c << std::endl;
return 0;
}*/
/*int main(void) {
int const * p;
int a = 1;
p = &a;
const int * const r = nullptr; // const pointer to const int
int **w;// ptr to ptr to int
return 0;
}*/
#include<iostream>
#include<vector
int main(void) {
std::vector<int> u{1, 2, 3};
std::cout << u[0] << std::endl;
std::vector<double> w{1.2, 5., 9.};
return 0;
}Editor is loading...
Leave a Comment