Added: 3 years ago
From: simplcool
Views: 17,947
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (40)

Sign In or Sign Up now to post a comment!
  • Nice tutorial! Visual tutorials help a lot!

  • Great video! First video I have seen to clearly illustrate what pointers really IS! THANK YOU!

  • thank u :)

  • What a boss, I want this guy to lecture me :D

  • Very Impressive...

    Thanx a lot :)

  • thanks for your help, this is one of the more difficult concepts to understand in programming

  • thanks..i skipped programming and now i need to learn these:)

  • thanx its realy help me

    

  • y he always say "start" ? it is star * not start :D

  • thnx you very much man

  • VERY helpful vid, just a small error though, you ended up changing ptr2 into address of y as well at 7:12 other then that, good job, so much clearer then my lectures.

  • How can Y be a interger I thought interger means numbers?? im confusedO_O

  • @MrOnix9009 y is the name of the integer. its just like algebra

    y+x=3

    y = 1

    x= 2

    x and y are both integers, the lettersjust represent numbers

  • This is so confusing O_o

  • How come you don't name the & amperand.

  • thanks!

  • whats the difference of making the '*' to the type or to the variable? i mean:

    int* ptr;

    int *ptr;

    Thanks!

  • No difference.

  • @exilePerformance no difference just your preference actually

  • this helped alot thnx man ! ! now i know how to use pointers but i still don't know why do we use em !!

  • you'll understand better when you use libraries.Ex: if you need to change the content of a variable in a function and you want to "save" the changes that you made on that variable, you can't avoid using pointers. Ex: void Change(int x) { x = 5 ; } int main() { int MyNumber = 12; Change( MyNumber ); cout<< MyNumber; return 0; } you'll notice that MyNumber didn't change and it's still equals to 12. try it yourself and try to figure out how to fix this problem, post your solution here ;) see you.
  • You could just pass by reference and eliminate the use of a pointer.

  • As far as i've learned, using a pointer IS passing by reference.

    If you mean using references to pass by reference, then you could do that, but a reference can only point to one address where as a pointer can be changed to point to a different address if you want.

    At least, thats what iv learned so far.

    sorry if im wrong.

  • @simplcool As its been 9 months, ill solve it for him. Instead of passing a copy of the argument, you should pass a reference (an address) that the value is stored at. In C++, we use the ampersand to do that. void Change(int &x) { x = 5 ; } int main() { int MyNumber = 12; Change( &MyNumber ); cout<< MyNumber; return 0; }
  • @FOOFlGHTERS Wont works, returns an error message : Invalid initialization of non-const reference of type int& from a temporary of type int*

    In passing argument 1 of void Change(int&)

  • @FOOFlGHTERS The right solution would have been :

    void change( int* a) {

    *a= 5;

    }

    int main() {

    myNumber=12;

    change(&myNumber);

    cout<<myNumber;

    }

  • @simplcool cant you simply just pass x by reference?

  • this is the clearest explanation ever. thanks very much

  • that table really helped, if only i was taught like that from the beginning.

  • very well explained, at last I understand pointers now :) thx for the help ! keep more tutorials coming!

  • thanks for making this; helped me a lot

  • Thanks, I haven't been able to get my head around pointers up till now

  • Thanks dude this has helped with my work a lot cheers

  • Very well explained, thanks.

  • Thanks! This helped me alot :-)

  • Great vid d00d!

  • pretty helpfull thanks

  • this totrial really helped me

    thanx alot :)

  • Thank you the was very helpful, can you please put more video.

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more