fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4.  
  5. using namespace std;
  6. int main(){
  7. int *iPtr = new int [5];//0-4, make a pointer act as an array of ints
  8. iPtr[2] = 50; // set a location in the pointer the same old array way.
  9.  
  10. cout << *(iPtr+2) << endl << &iPtr << endl << &iPtr+2; // Take mem location of iPtr + 2 of sizeof(type) *iPtr
  11.  
  12. char *ohai = "Ohai Thar, how are you?"; // Using a char pointer as a string
  13. char fbp[256]; // initializing a char array to 256 characters
  14.  
  15. strcpy(fbp, ohai); // copying pointer ohai to FBP (filled by pointer)
  16. cout << endl<< fbp; // cout fbp
  17. return 0;
  18. }
  19.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:12: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:15: error: ‘strcpy’ was not declared in this scope
stdout
Standard output is empty