Tuesday, April 6, 2010

There is one step from hate to love...

OK guys now rise your hands who love pointers!
No one? Really?
Then lets do the work-through!

#include
int main(){
int i;
int j;
int a[5]={1,2,3,4,5};
int b[3][5]={
{1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15}
};
printf("%d\n", *a); //Try to find two differences
printf("%d\n", **b); //in those two lines.....No rush, take your time :-)
return 0;
}
Now look to the result:
1
1
Now you know that name of array is a pointer to the first member stored
in the array, but if it is two dimensional array then name of the array
is a pointer to pointer to the data stored in first member of the array.
And if you want to scary somebody you can print something like *************c.
But it is deep night and I will afraid to do something like that.
Ok ok I know you don't feel good about me already. But wait a minute I didn't
promise that you going to love pointers! I just said that "There is one step
from hate to LOVE". Sorry there is no magic here...
Magic is here: Punk Magician
And you gonna LOVE it :-)

Wednesday, March 17, 2010

Skype, Google talk... and Microphone? Not necessary:-)

In our days programmers often use programs like Skype, Google talk, MSN, etc for conference calls. In order to participate in the call you need:
1. Computer with one of the program installed on it.
2. Internet.
3. Speakers.
4. Microphone.

But what to do if somebody already calling to you but you don't have microphone? How many of you tried to shout to your computer in hope that it has embedded microphone? :-). Solution was very close. In situation like that you just need to plug in another earphones in a plughole for microphone and talk to left earphone. Keep it very close to your mouse and also you may need to put microphone volume on maximum. For urgent call the quality of sound is very very acceptable but if you consider to have a long relationship with somebody on other end of the internet consider to buy a good microphone.

Wednesday, March 3, 2010

int* p=0;

There is a little program:
#include
int main(){
int* p=0;
p++;
printf("%u\n", p);
return 0;
}
The output is: 4
and the program runs without mistakes and warnings.
But why I couldn't run the next one?

#include
int main(){
int* p=4;
printf("%u\n", p);
return 0;
}

in other words my question would be:
How to make p=4 at one stroke?

Monday, January 11, 2010

About me and learning C++ in Seneca college.

O my god I just created my first blog.
If it goes like this I will become a computer geek.