@tedtdu You don't need to 'return' a value from the function because that's what the pointers are for. You can only 'return' one value from a function so instead you can use pointers. When you assign a value to a pointer (even in another function) it will assign that value to the variable which it points to. So the user's input assigns that number to the pointer, which automatically sends the value to the variable in 'main'.
My programming professor never explained this well. I didn't understand this concept till my second c++ quarter when I had a better professor. Will you be showing how to create simple games in the future?
before explaining pointers it would be easier to explain scope first, then you can explain how they can remove the limitation of scope this way it will hopefully make them easier to understand and why you would use them. NOT critisizing your Vid but this would probably make it easier for you to explain
each time he completes a modification, he records the vehicle's mileage before driving, the mileage after driving and the amount of fuel consumed for the trip.
Charlie has asked you to write him a program that calculates his fuel efficiency in miles per gallon. Create the IPO Model and pseudocode algorithm for this program. Include error checking such that the mileage of the vehicle after driving cannot be a lower value than that entered for the mileage before driving.
You dont need to do a semicolon there. In fact I think you would even get a compile time error for doing it, since it is a function not a class. You can just make the curley braces and write the content in between and then call it. What he is doing is declaring it first in the top and the definining it in the bottom, something I dont prefer doing but many prefer to do so.
But thats beside the points. The main thing is the guy is not working with pointers per se. Int firstpointer; This isnt a pointer as the video suggests. Thats just an int variable.
int *p1;
int thirteen= 13;
p1 = &thirteen;
Now we have a pointer, pointing to thirteens memory store.
and then the pointer is passed raw as an argument to the function:
Or we could even skip the variables altogether with lets say:
int *p1;
p1 = new int;
*p1 = 13;
Now the pointer points to a memory location which holds 13 and you can manipulate the number in that memory location just as you would if it had a variable attached to it.
Nice job, pointers are definitely one of the hardest things to comprehend in C++. I still only have a basic understanding of them. You did clear some stuff up for me.
there's more wrong with it than that but I'm lazy so I won't fight you, you can program anyway you prefer though. It's just not considered good practice.
Oh me niether I'm just saying I didn't mean to look like I was telling him how to program, I just reread that and thought it sounded kinda meanXD anyways well met!
Dude you should explain that an Pointer is just an address to the memory and if you do not declare it as a pointer its getting dynamicly allocated which is also deallocating when the function returns.
Maybe you should go deeper into malloc/free for people so they understand why use them and when.
Pointers are cool in C. Linked lists and recursive binary trees. In C++ I would just use the classes they have written for you. Plus your still writing functions in C. Where is the C++? Write a class with some data and member functions.
What do you with all that tiping and numbres ?? what do you get a progarm a calculetor ?? how do you get from this to let say mario in NEs . can someone explain that to me ?
well thats what i meant, its hard to explain them so that ppl can understand. i guess u just have to do them a few times... my teacher drew a diagram and that helped ALOT.
ahh, good, your teacher... Wish i had a teacher, would probably make things make a lot more sense. 15 doing this on my own... pretty hard if you ask me =( but i do understand pointers being used in functions now, thanks reconnetworks :)
ok if i had a chessboard declared as 0 - 63 squares, and i used a pointer array of 16 to hold the locations of only the white pieces on the board this qould not be a good analogy cause it is not the same idea actually i am just rambling cause i don't really care for pointers ..yet
You can't use multiple address operators; However you can create a pointer to a pointer, or a pointer to a pointer to a pointer, like this int*** p; Then you can make that point to a pointer to a pointer, which in turn can point to a pointer; int*** p1; int** p2; int* p3; int data = 5; p1 = &p2; p2 = &p3; p3 = &data;
You forgot to mention why you would use pointers. It works with the original data instead of a copy. Unlike passing by value, pointers actually alter the data. It's also very important to mention the importance of const.
Your pointerFunction is useless...... you use just integer variables. result = int1 + int2; ... ;D .. but you can see the point of your video if you already have progamming skills... make another example where pointer function would do something in 'main'... :P
So let me get this straight. That * thing means refers to the address of whatever variable name it precedes (pointer). The & beside the variable name means the address of where the variable stores data?
This is where pass-by-reference is needed. If you actually *want* the called function to change main_x and main_y, you will have to pass it the "address-of" or "pointer-to" the actual variables so that it can change them.
In my example, f2 is actually designed in a way so that it can change the variable that was passed in.
To answer Xyaon's question, if you pass by-value instead of by-reference, the function will only modify it's local variables and the original variables will remain the same.
{ int main_x = 4; int main_y = 5; // You can call f1 like this f1(main_x, main_y); // OR like this f1(4, 5); // You have to call f2 like this f2(&main_x, &main_y);
}
When a parameter is passed to a function, the called function makes a copy of that parameter and stores it in another local variable. In the above example f1 stores 4 in f1_x and 5 in f1_y as soon as it starts executing. Changing f1_x and f1_y within f1 do NOT change main_x and main_y.
In this video, you need pointers because you want the "called" function to be able to modify the variables that actually belong to the "caller" function.
There are two ways of passing a parameter to a function. By-value and by-reference.
I think that you're referring to dangling pointers... If you don't define a pointer it is initialised to 0xCCCCCCCC and if you attempt to dereference it (in a good IDE like VS) you'll get a "Run-Time Check Failure".
He was nice to listen to and explained a lot of stuff in clear English, but it was kind of frustrating to write 5 lines of code only to hear "Whoops!" and then have to delete it.
Also, where is this huge tutorial #4 was "preparing" us for? I'm kinda dissapointed :\.
I just want to point out this code is rout with poor practices. One of these being hungarian notation. Make sure you do NOT use hungarian notation, it is a sign of very poor programming. If there is any confusion about what types your variables are or if the function you're working on is nested so deeply and is multiple screens long, it is coded incorrectly and needs to be re-done. Never should such a hackish notation be adopted to fix the problem.
you are right. i do not understand why ppl are still using stupid hungarian notation although stuff developed so much not need HN to organize shits..:/
i dont really think theres a better, just maybe easier to use. im using Borland C++ 5.5.1 (which uses command prompt for compiling and editing) and i can follow these fine.
Dev is good. You just need to know how to use it. When you start a project, you don't have to do all tnese things like you need to do with microsoft. and when you get in to "window's programming" you don't need to use the stupid runtime files in your projects. (when you send it out)
Hey.. good video's.. are you going to put anything up on C++ Classes and good working example of its use. Would be very much appreciated. Thanks again for your time.
Pointers are important to keep in mind; however, ALWAYS think to yourself: "Is this going to be the quickest, most efficient way to program this?" Remember that there are always a billion ways to accomplish something in programming, the trick is finding the simplest way to do it.
What's being displayed here is a simplified explanation of syntax and usage, not a viable solution to this specific issue.
Pointers are important tools when working with an highly compliant object-oriented (OO) language like C++. One of the fundamentals of OO is encapsulation which prevents one function from interfering with another including accessing or manipulating data. A pointer foils this by allowing another function to access the specific memory location the datum is stored in. Since it is referencing a memory location and not a variable in the program, it is not limited by OO.
I don't see the point of using pointers, I mean, you could´ve used the function just with the variables you declared before. I can only imagine using the pointers if i want to know the address of the variable I´ve declared, but no other. well, I´m an amateur at C++, and I´m not going to learning more about it, but I would like to know a really important use for the pointers.
Honestly, if you're looking at making a windows application, I'd recommend Visual Basic. You can get a free version from Microsoft (Visual Basic Express). This will work for most development needs and is quicker to develop in than C++.
thanks, am starting to catch on the difference between the two laguages of C and C++. i am new to c and i have not notice the c++ is a little different.
edfast46 ...C is basically C++...just a modified C....
if you really want to learn C++ or even C... i can show you a way you can learn about 95% of the language in a week... 2 days if you have some programming experience. i have been programming in C++ for 7 years on and off so i know it very well;
@reconnetworks actually C++ is not object oriented its multiparadigm meaning it supports many different styles of programming and not just object orientation its actually a completely false misconception calling C++ object oriented
You left out saying what is the function prototype,and the function header, and how the arguments pass through the function header as function peramaters, do the video right if your going to teach c++.
Wow, I know HTML, CSS, JavaScript, DHTML, and BAT and I find C++ pretty confusing. This is definetally gonna take some time to learn but not that long with these awesome tutorials xD
waltermodel43 is a classic flamer on youtube. He flames in hope to get to you. It's too bad there is no career for flaming because people really act like it's there job to piss people off... What a c-flamer.
*5 years in the future*
When does tutorial 6 come out? :D
epicdista 3 weeks ago
@tedtdu You don't need to 'return' a value from the function because that's what the pointers are for. You can only 'return' one value from a function so instead you can use pointers. When you assign a value to a pointer (even in another function) it will assign that value to the variable which it points to. So the user's input assigns that number to the pointer, which automatically sends the value to the variable in 'main'.
TheWeirdTechGuy 2 months ago
This has been flagged as spam show
Hey guys, check out my page if you need some more help. Covering each C++ component week by week, drop a comment if you need help.
ComputerTechBoss 2 months ago
Since "pointerfunction" does not return, how can the firstpointer and secondpointer equal to the number using inputs?
tedtdu 2 months ago
so basic hahaha
123hamxa 4 months ago
What's the meaning of the asterisk in your program.
Please just mail me your answers. Thanks..
eminemchu43 7 months ago
@eminemchu43 rtfm
NINBNIN 5 months ago
firstpointer and secondpointer are not pointers- they are variables, their ADDRESSES are pointers.
panda123227 7 months ago
ok i understand now :D btw i also finally learned what endl; does cuz you stoped using it alot in this one :)
NebulaOrbit 7 months ago
ewww, he's using system("pause") such a windows dependent function.
MagicalMan687 9 months ago
Nice one, 4 was a bit confusing and long but I think this cleared it up a little
TheWeirdTechGuy 10 months ago
Do you know how to like run a Runcount which means the timer would run like this:
01 02 03 0 40 50 60 07 08..
side by side after 1 sec?
profiremine 1 year ago
lookup for loop thats probably the first program that will show up
you123123123123 11 months ago
Thanks for this. Pointers have now stuck thanks to you, and I shall now move on :)
endacraigdotcom 1 year ago
My programming professor never explained this well. I didn't understand this concept till my second c++ quarter when I had a better professor. Will you be showing how to create simple games in the future?
LaTarasque 1 year ago
Could you possibly say "out and about, i pout with a trout" in the next video?
XXxZAKKxX 1 year ago
@XXxZAKKxX wtf?
benny21003 1 year ago
@benny21003 I like canadian accents >_>
XXxZAKKxX 1 year ago
So wat happened to the "big vid" u promised was going to come out?? *disappointed*
jis2507 1 year ago 13
before explaining pointers it would be easier to explain scope first, then you can explain how they can remove the limitation of scope this way it will hopefully make them easier to understand and why you would use them. NOT critisizing your Vid but this would probably make it easier for you to explain
glenc70 1 year ago
can i make game hacks with this programme??
Raytzuno 1 year ago
@Raytzuno Learn memory editing with c++ and YES you can.
XXxZAKKxX 1 year ago
*sigh*
I miss GOSUB and GOTO
ManOfMeans 2 years ago
@ManOfMeans lol what is that, basic?
sodafountan 1 year ago
lol Yes, actually
ManOfMeans 1 year ago
can u help with this
each time he completes a modification, he records the vehicle's mileage before driving, the mileage after driving and the amount of fuel consumed for the trip.
Charlie has asked you to write him a program that calculates his fuel efficiency in miles per gallon. Create the IPO Model and pseudocode algorithm for this program. Include error checking such that the mileage of the vehicle after driving cannot be a lower value than that entered for the mileage before driving.
douglarizethenation1 2 years ago
i luv pie :3
TyranitarDraken 2 years ago
just a suggestion : please use comments on your code so we can follow them better instead of saying "you already know".
gonzalezluis78 2 years ago
Weird number? MY MOTHER WAS A SAINT!
Lemoncode 2 years ago
LOL you could do like this too and its much easier:
void functionname(BLAH HERE)
{ // Stuff here
}; <- adding a semicolon would declare it so you dont have to voiding it twice!!
OlloX3 2 years ago
You dont need to do a semicolon there. In fact I think you would even get a compile time error for doing it, since it is a function not a class. You can just make the curley braces and write the content in between and then call it. What he is doing is declaring it first in the top and the definining it in the bottom, something I dont prefer doing but many prefer to do so.
FreddieBambino 2 years ago
But thats beside the points. The main thing is the guy is not working with pointers per se. Int firstpointer; This isnt a pointer as the video suggests. Thats just an int variable.
int *p1;
int thirteen= 13;
p1 = &thirteen;
Now we have a pointer, pointing to thirteens memory store.
and then the pointer is passed raw as an argument to the function:
pointerfunction(p1);
not with * or &.
Cheers.
FreddieBambino 2 years ago
Or we could even skip the variables altogether with lets say:
int *p1;
p1 = new int;
*p1 = 13;
Now the pointer points to a memory location which holds 13 and you can manipulate the number in that memory location just as you would if it had a variable attached to it.
FreddieBambino 2 years ago
You don't add a semicolon after declaring a function.
AES256bit 2 years ago
Yes you do.
OlloX3 2 years ago
Nice job, pointers are definitely one of the hardest things to comprehend in C++. I still only have a basic understanding of them. You did clear some stuff up for me.
jc987 2 years ago
is this what The Behemoth uses to make games?
ryuken104 2 years ago
dont you have to put /n at the end of statements?
johnnyc130 2 years ago
'/n' is a newline character.
jarjarbinks77 2 years ago
Its just another way of ending a line. Just like endl
0121ryanh117 2 years ago
wat exactly does this program do
BobSaget37 2 years ago
I need help trying to build a code that will show a temperature table and prompt the user for beginning end and increment. any ideas?
shankman2k9 2 years ago
Can you describe your program a little better?
Mootsterdotcom 2 years ago
This has been flagged as spam show
he uses old programming techniques.
Subscribe to my channel, i post new generation c++ programming tutorials.
What he is showing is bad pratice.
New videos will be available every 2-5 days on my channel too!
cprogrammerc 2 years ago
/n ftw
endl = boo
deadleg22 2 years ago
Use both
vivevice 2 years ago
Ive been learning c++ for a while and i'm not close to you, but i don't get and haven't ever needed to use endl;
mjsdabeast 2 years ago
It's just to make it look better, going a line down in the console
Guillee92 2 years ago
As you can see at 5:19, the 12 is next to "Press any key... Blabla", when you put an endl; there it would look like
"12
Press any key to continue..."
Guillee92 2 years ago
so its just like putting " blah blah blah /n"
mjsdabeast 2 years ago
shut up!!!!!!!! asshole!!!!!!
cavalodetroia100 2 years ago
I'm glad you put the asterisk beside the type name rather than the variable name. Much more intuitive.
captainsurrey 2 years ago
Yo! great vid..i have a question though...does that mean that the pointers are exactly the same thing as formal parameters in a function's argument??
zoulation 2 years ago
Please, teach us how to program with classes
MenaceVisionz 2 years ago
nothing on virtual classes?
GeokerRom 2 years ago
im teaching simple console applicatons... its not improper practice.
reconnetworks 2 years ago 5
@reconnetworks Do you have any C++ GUI Tutorials?? All I can find are console, thanks, =).
rick8028 11 months ago
Can you show us how to do a operator overload using a string with an array. Like a complex number class using the +, -, *, /, =, ==, and <<.
Angkarol 2 years ago
what software you used? is that dev c++?
cyther39 2 years ago
that's Microsoft Visual C++
EarthBoundGame 2 years ago
no its dev C++ he says in the first vid
element1988 2 years ago
You're a stupid dumb ass, that's Visual Studio. Get A What.
EarthBoundGame 2 years ago
yea your right, but he does say hes using devc++ in the first vid... get a what? lol wtf does that mean where your from lol
element1988 2 years ago
I'm from CannabisLand.
EarthBoundGame 2 years ago
Don't use system("PAUSE")
use getchar
cmon, educate the masses!
eatcomics 2 years ago
Theres nothing wrong with system("PAUSE");
You can use the cin.get() function but it's not needed
mjd9208 2 years ago
What about the fact that it will only work on Windows?
Ilikemustard 2 years ago
Yeah, but I was talking in context of the video, in which he is programming a Windows machine.
mjd9208 2 years ago
there's more wrong with it than that but I'm lazy so I won't fight you, you can program anyway you prefer though. It's just not considered good practice.
eatcomics 2 years ago
I'm not looking for a fight, just knowledge.... or something like that
mjd9208 2 years ago
Oh me niether I'm just saying I didn't mean to look like I was telling him how to program, I just reread that and thought it sounded kinda meanXD anyways well met!
eatcomics 2 years ago
You might want to explain Scope, if you're going to explain pointers, since they are the main reason that people even USE them.
rsman222 3 years ago
Pointers are simple..........but Nodes and linklists DOMINATE ME :'(
RedKiller69 3 years ago
Dude you should explain that an Pointer is just an address to the memory and if you do not declare it as a pointer its getting dynamicly allocated which is also deallocating when the function returns.
Maybe you should go deeper into malloc/free for people so they understand why use them and when.
ZeroMemPtr 3 years ago
Pointers are cool in C. Linked lists and recursive binary trees. In C++ I would just use the classes they have written for you. Plus your still writing functions in C. Where is the C++? Write a class with some data and member functions.
lafinboylafbubba 3 years ago
This has been flagged as spam show
Click on my channel to see an excellent Beginner C++ Tutorial
InfernoDevelopment0 3 years ago
I know your not in youtube much but can anyone tell me how to make that symbol for the address.
4 line of int main().
willthewiremage 3 years ago
Hey matie, since no1 seems to help you...
The symbol is &
;)
cholover 3 years ago
u using notepad++? looks like it. if so same
fatblob16 3 years ago
I wasn't asking for your email? :)
I was wondering if this reconnetworks guy will post more stuff on OOP of C++.
OOP = object oriented programming
NajanJan 3 years ago
I checked out your website but couldn't find your email or anything to contact you with?
how come you don't put more videos?
NajanJan 3 years ago
Hi,
thanks for these tutorials.. are u going to put some tutorials on OOP part of C++?
NajanJan 3 years ago
whats OOP?
Garfler 3 years ago
Object Oriented Programming.
GatMan183 3 years ago
Very helpful. Thank you.
Falryu 3 years ago
hei. are you going to continue with the tutorial series or not? :-S
marverde7 3 years ago
What do you with all that tiping and numbres ?? what do you get a progarm a calculetor ?? how do you get from this to let say mario in NEs . can someone explain that to me ?
pliskinn0089 3 years ago
thnk you Jim
rasstuttgart 3 years ago
int firstpointer, secondpointer, result;
mupatoo 3 years ago
Isn't this called pass by reference using pointers. Note also, the address of operator is different to a reference.
ednutey 3 years ago
I tried putting in a program I made but everything I tieped gave a error! Please send message!
Ericiscutie 3 years ago
just something about the compiler, why can't i link iostream into my projecT?
jnbjabnk 3 years ago
explaining pointers is really hard... but i think u did a pretty decent job. i now understand them a lot better.
Matt23488 3 years ago
Explaining pointers is easy, understanding them is the hard part.
Ilikemustard 3 years ago
well thats what i meant, its hard to explain them so that ppl can understand. i guess u just have to do them a few times... my teacher drew a diagram and that helped ALOT.
Matt23488 3 years ago
ahh, good, your teacher... Wish i had a teacher, would probably make things make a lot more sense. 15 doing this on my own... pretty hard if you ask me =( but i do understand pointers being used in functions now, thanks reconnetworks :)
ultrablade2 3 years ago
Likewise, pointer's a tough subject for me to grasp (16), I'm used to managed code, .NET, etc.
Predator106 3 years ago
i didn't quiet get it :S...
theman1860 3 years ago
new site is reconnetworks . net
askegk 3 years ago
ok if i had a chessboard declared as 0 - 63 squares, and i used a pointer array of 16 to hold the locations of only the white pieces on the board this qould not be a good analogy cause it is not the same idea actually i am just rambling cause i don't really care for pointers ..yet
DeepGlue555 3 years ago
can we adress with complex pointers ...like &&&xds
bouguern 3 years ago
Ilikemustard 3 years ago
Pointers are a pretty complicated thing, it takes a while to really figure out - so dont get depressed when you dont learn it instantly.
GL teaching 'classes' on youtube :P (Not classes as in classrooms)
Mech1000 3 years ago
You forgot to mention why you would use pointers. It works with the original data instead of a copy. Unlike passing by value, pointers actually alter the data. It's also very important to mention the importance of const.
croakacola 3 years ago
New website is reconnetworks.net/forum
See you there, Icemens =)
askegk 3 years ago 2
good
myhoneysdwr00m 3 years ago
for anyone who is interested, the new site is reconnetworks(.)net(/)forum
k3ystone 3 years ago
нэпонатно
Tigran993 3 years ago
you guys cannot correct what this guy is doing... he is trying to make a video for people to begin to use c++ programming
Knektor 3 years ago
He's teaching C++ and in this situation, pointers should not have been used. He should have references instead.
nemesisrobot 3 years ago
that is very true.. it looks more like c
dvserver1 3 years ago
This comment has received too many negative votes show
Use Java :)
systat 3 years ago
Java is quite inefficient, but simpler! C++ is efficient for intensive code!
countryeugene 3 years ago
you forgott " excuse me " when u *host* xD hhaha u said that on tut 1
OlloX3 3 years ago
very useful stuff listen to this guy!
dosattack777 3 years ago
Your pointerFunction is useless...... you use just integer variables. result = int1 + int2; ... ;D .. but you can see the point of your video if you already have progamming skills... make another example where pointer function would do something in 'main'... :P
vipmantas 3 years ago
I think it would be better instead of typing "cout << endl;" you could just type "cout <<"\n ..."
lnknprkman 3 years ago
endl flushes the buffer.
marmuhlade 3 years ago
Oh now i understanded what you wanted to tell us.
Vogeldoktor21 4 years ago
A very wise C programmer once told me...
"There are two types of C programmers, ones that don't know pointers, and the successful ones that do."
MyOverflow 4 years ago
So let me get this straight. That * thing means refers to the address of whatever variable name it precedes (pointer). The & beside the variable name means the address of where the variable stores data?
Juelz85 4 years ago
no;
* means the value pointed to by the pointer
and & means the address of something.
when you initialize a pointer, say int*pointerx;
in that case, the * just means pointer
14DarkZero14 3 years ago
that was at juelz85
14DarkZero14 3 years ago
This is where pass-by-reference is needed. If you actually *want* the called function to change main_x and main_y, you will have to pass it the "address-of" or "pointer-to" the actual variables so that it can change them.
In my example, f2 is actually designed in a way so that it can change the variable that was passed in.
To answer Xyaon's question, if you pass by-value instead of by-reference, the function will only modify it's local variables and the original variables will remain the same.
madakhan 4 years ago
int main(void)
{ int main_x = 4; int main_y = 5; // You can call f1 like this f1(main_x, main_y); // OR like this f1(4, 5); // You have to call f2 like this f2(&main_x, &main_y);
}
When a parameter is passed to a function, the called function makes a copy of that parameter and stores it in another local variable. In the above example f1 stores 4 in f1_x and 5 in f1_y as soon as it starts executing. Changing f1_x and f1_y within f1 do NOT change main_x and main_y.
madakhan 4 years ago
For example:
void f1(int f1_x, int f1_y); // By-value
{ f1_x = 100; // Change only local variable, no effect on caller's variable f2_y = 200;
}
void f2(int* f2_x, int* f2_Y); // By-reference
{ *f1_x = 100; // Change the caller's variable *f2_y = 200;
}
madakhan 4 years ago
In this video, you need pointers because you want the "called" function to be able to modify the variables that actually belong to the "caller" function.
There are two ways of passing a parameter to a function. By-value and by-reference.
madakhan 4 years ago
So, i still don't see why someone uses pointers. I kinda get how to use them. How does using pointers do anything for you in this example.
gibsonrocker800 4 years ago
I was wondering , im still not to sure about why to use pointers. ( Sorry im a PHP programmer so i havn't really understood pointers:P )
But isnt it just the same to use:
pointerfunction(int var1, int var2){ cin >> var1 >> var2;
}
and ofc call it without all those pointers ?
Sorry for my noobness
Xyaon 4 years ago
int main()
{ int* firstpointer = NULL;
int* secondpointer = NULL; pointerfunction(a, b); return 0;
}
:) You should really teach proper use of pointers; check if the pointers are valid. If they're not, then return early.
mybowlcut 4 years ago
If you don't define pointers, then you can get a value of anything, even the value of a string in a word document, and changing it.
spadexeon 4 years ago
I think that you're referring to dangling pointers... If you don't define a pointer it is initialised to 0xCCCCCCCC and if you attempt to dereference it (in a good IDE like VS) you'll get a "Run-Time Check Failure".
mybowlcut 4 years ago
Just incase anyone learning is curious, these are two ways that dangling pointers can be produced (something that you should AVOID):
int* i = new int(3);
delete i;
*i = 5;
or
int* f()
{ int temp = 5; return &temp;
}
mybowlcut 4 years ago
Al of your tutorials are great noobs like me :D Thx, but I dont still know the pointers so good :)
Ajizi 4 years ago
Cool...much better now :D when's the next one??
ricardocameron 4 years ago
this dude is keep talking in the video but saying nothing useful...he is confused for himself. can anyone tell this dude stfu?
bookgekgom 4 years ago
Shaddup!
ricardocameron 4 years ago
i think that bookgekgom have right, if u want to learn programming this noob ain't gonna help ya'
Oldsellerros 4 years ago
He was nice to listen to and explained a lot of stuff in clear English, but it was kind of frustrating to write 5 lines of code only to hear "Whoops!" and then have to delete it.
Also, where is this huge tutorial #4 was "preparing" us for? I'm kinda dissapointed :\.
Oh well, pretty good tutorials :P.
marmuhlade 4 years ago
i see that truth is hurting some people :>
Oldsellerros 4 years ago
I just want to point out this code is rout with poor practices. One of these being hungarian notation. Make sure you do NOT use hungarian notation, it is a sign of very poor programming. If there is any confusion about what types your variables are or if the function you're working on is nested so deeply and is multiple screens long, it is coded incorrectly and needs to be re-done. Never should such a hackish notation be adopted to fix the problem.
jMerliNz 4 years ago 2
stfu noob.
softwareguy256 4 years ago
lol k
Urrzah 4 years ago
you are right. i do not understand why ppl are still using stupid hungarian notation although stuff developed so much not need HN to organize shits..:/
bookgekgom 4 years ago
guys is visualc++ 2005 is much better then 2003 ?? cuz i've download the 2005 but i think it has some console missing :S
xkoko12 4 years ago
i dont really think theres a better, just maybe easier to use. im using Borland C++ 5.5.1 (which uses command prompt for compiling and editing) and i can follow these fine.
ElSpookay 4 years ago
i use visual C++ to use c++
and blueJ for Java, (good starter program)
lubu195 4 years ago
why didn't you use references since this is a c++ tutorial?
pacificat0r 4 years ago
how come everything i do doesnt work when i have done everything exacly how u said
updatedhiphop 4 years ago
coz ur a noob lol!!!
Urrzah 4 years ago
i use DEV also it is BAAAD
lifeiscomplexing 4 years ago
Dev is good. You just need to know how to use it. When you start a project, you don't have to do all tnese things like you need to do with microsoft. and when you get in to "window's programming" you don't need to use the stupid runtime files in your projects. (when you send it out)
eaxcriminal 4 years ago
oh wait he said in his first video it was dev C++ but my dev C++ looks different um strange
lildannya 4 years ago
Looks like it's Visual Studio...
MarkLoveFYI 4 years ago
It is.
AntiOwnage 4 years ago
What name of IDE ?
EG142 4 years ago
visual studio 2005
someone correct me if am wrong but i dont use it
i use dev C++
lildannya 4 years ago
Hey.. good video's.. are you going to put anything up on C++ Classes and good working example of its use. Would be very much appreciated. Thanks again for your time.
p90pickup 4 years ago
Pointers are important to keep in mind; however, ALWAYS think to yourself: "Is this going to be the quickest, most efficient way to program this?" Remember that there are always a billion ways to accomplish something in programming, the trick is finding the simplest way to do it.
What's being displayed here is a simplified explanation of syntax and usage, not a viable solution to this specific issue.
nexus1g 4 years ago
Pointers are important tools when working with an highly compliant object-oriented (OO) language like C++. One of the fundamentals of OO is encapsulation which prevents one function from interfering with another including accessing or manipulating data. A pointer foils this by allowing another function to access the specific memory location the datum is stored in. Since it is referencing a memory location and not a variable in the program, it is not limited by OO.
nexus1g 4 years ago
I don't see the point of using pointers, I mean, you could´ve used the function just with the variables you declared before. I can only imagine using the pointers if i want to know the address of the variable I´ve declared, but no other. well, I´m an amateur at C++, and I´m not going to learning more about it, but I would like to know a really important use for the pointers.
aquiro 4 years ago
Thanks for all tutorials!
But I've got a question, Do you know how to make a window in C++? I mean not in a console.
stijnschoor 4 years ago
Honestly, if you're looking at making a windows application, I'd recommend Visual Basic. You can get a free version from Microsoft (Visual Basic Express). This will work for most development needs and is quicker to develop in than C++.
nexus1g 4 years ago
pointers are the same thing as variables when they are local, so I dont understand the question any more... :/
reconnetworks 4 years ago
To change an int to a char you can use static_cast, read up on it or ask about it on reconnetworks dot com
reconnetworks 4 years ago
hey... i know how to change an int to char... im talking about changing on pointer type to another
dsurtai1 4 years ago
thanks, am starting to catch on the difference between the two laguages of C and C++. i am new to c and i have not notice the c++ is a little different.
edfast46 4 years ago
hey reconnetworks i need your help on something...
do you know how to convert an int* to char*?
I tried using a reinterpret_cast, it converts to a different pointer but the value it points to changes.
dsurtai1 4 years ago
edfast46 ...C is basically C++...just a modified C....
if you really want to learn C++ or even C... i can show you a way you can learn about 95% of the language in a week... 2 days if you have some programming experience. i have been programming in C++ for 7 years on and off so i know it very well;
dsurtai1 4 years ago
c++ is just a superset of the c language, and is object oriented. You have to give specific examples of your problems if you want an answer :/
reconnetworks 4 years ago
@reconnetworks actually C++ is not object oriented its multiparadigm meaning it supports many different styles of programming and not just object orientation its actually a completely false misconception calling C++ object oriented
ANXIOUS117 1 year ago
solve
edfast46 4 years ago
ever try to mix C with C++ and try to solvve any programs with the two.
edfast46 4 years ago
alot of these are cross compatible.
reconnetworks 4 years ago
Question? Is C to old to learn and is it worth it to learn it now?
edfast46 4 years ago
ok, thanks am stuck on pointers and arrays passing to the functions can you do a video on that in C pragramming, if not thanks.
edfast46 4 years ago
I can teach my tutorials however I want, thanks.
reconnetworks 4 years ago
You left out saying what is the function prototype,and the function header, and how the arguments pass through the function header as function peramaters, do the video right if your going to teach c++.
edfast46 4 years ago
Hey, thanks for the awesome tutorial... keep it up man...
hawkforce 4 years ago
no problems man, thanks for the compiment! :)
reconnetworks 4 years ago
Wow, I know HTML, CSS, JavaScript, DHTML, and BAT and I find C++ pretty confusing. This is definetally gonna take some time to learn but not that long with these awesome tutorials xD
MasterJake777 4 years ago
waltermodel43 is a classic flamer on youtube. He flames in hope to get to you. It's too bad there is no career for flaming because people really act like it's there job to piss people off... What a c-flamer.
poopminion 4 years ago