Category : C Source Code
Archive   : CPTUTOR2.ZIP
Filename : POINTERS.CPP
#include "iostream.h"
main()
{
int *pt_int;
float *pt_float;
int pig = 7, dog = 27;
float x = 1.2345, y = 32.14;
void *general;
pt_int = &pig;
*pt_int += dog;
cout << "Pig now has the value of " << *pt_int << "\n";
general = pt_int;
pt_float = &x;
y += 5 * (*pt_float);
cout << "y now has the value of " << y << "\n";
general = pt_float;
const char *name1 = "John"; // Value cannot be changed
char *const name2 = "John"; // Pointer cannot be changed
}
// Result of execution
//
// Pig now has the value of 34
// y now has the value of 38.3125
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/