@Brandlax You can also end any loop by typing "break;" an example would be "if (x==3) break;" then the program would get out of the loop when x is equal to 3
hi bucky, you can avoid appearing to look to your left anytime you check to your remind yourself of what to teach by placing the monitor above the camera. That way, you will still appear to be looking at the listener (just like a teleprompter). You're awesome!
I just want to say thanks, I'm switching over from C++ which is a bit difficult since I'm used to everything being a certain way. You've made it very easy to understand. :)
The difference between i++ and ++i is not just personal preference. When used in code putting the ++ after the variable returns the current value and increments the variable by one. Putting the ++ before the variable increments the variable by one THEN returns the value. This is irrelevant when used in a for loop but could result in unexpected results when you try to use it elsewhere.
i++ is post increment. ++i is pre increment. For example: int i = 3; NSLog(@"%i", i++); // outputs 3 NSLog(@"%i", i); // outputs 4 NSLog(@"%i",++i); // outputs 5 NSLog(@"%i", i); // outputs 5 I don't think it makes any difference when used in a for loop step.
@livewithdavid I was just about to post the same thing. That seems to be a commonly misunderstood idea when someone is learning to program. One other thing, You can do increment adjustments on characters. What it does it adds one binary digit to the letter, making it one higher. So if: char a='a'; a++; NSLog(@"%c",a); you would get 'b' as your output. This can be used to change the case of a character. to make a lower case letter capital subtract 32, and vise versa.
I know that it has been 10 years, but: There is a difference between x++ and ++x, x++ is an expression that gives you the value of the variable and then increments it, and ++x is an expression which increments the value and *then* give it to you. Also, increment and decrement operators work on pointers as well. And, you should really mention that scanf, for loops, and most datatypes came from C.
%c is the wrong conversion; you need to use %s because your name, Rick, is a string. Strings are basically words, anything more than a single character is a string even though a character can be a string, but that's another story. scanf("%s", userName); NSLog(@"Your name is %s", userName); Also an ampersand is not needed when your variable name is a string.
@louisdebmusic There are equivalent functions, it's just (slightly) bad practice to use i+=1 because adding one to a variable is so common that they (the creators of objective C and C) added i++ to add 1 to the variable, the += is generally used for numbers larger than 1.
actually there is a difference between i++ and ++i; ++i is telling the computer that add one to whatever variable that is next. and i++ is saying read the variable i then then ++ will add 1 to the variable. they might sound the same but its' actually not. for instance if you do an array of array[count++]; and say count was intialise as 0; then they will look at array[0] but after that count become 1 and next array[count++] will be array[1]. array[++count] will in this case be array[1].
hey bucky was up ive been watching your tutorial man i love them seriously can you explain to me what a memory leak is at around 5:46. consequences solutions etc.
if your using xcode 4, and when inputting your number doesn't do anything, make sure you hold down shift key and then press enter after inputting the number in the console. I was stuck on this for a few minutes.
So, you're saying that the "@" not he NSLog is for Objective-C stuff. then is it valid to use the "printf" from C instead of the "NSLog" ? and if that's the case, what are the benefits? Thanks man, awesome video tutorials you have here.
I had an issue entering the number. Apparently the "return" key works and the "enter" key does not. Just thought I would point it out in case anyone else had the issue. If they're the same key I think you have to hit shift.
I know that this tutorial was 10 years ago, but there is. Actually there are multiple. 1. NSLog automatically adds a new line, and printf doesn't, so this can be useful for making a program like the following: int main(int argc, const char * argv[]) { @autoreleasepool { for (int i = 1; i
Bucky, For some reason, although I followed your code flawlessly, my code comes out with the number I input PLUS 1. Why is this? Thanks for all your help! :D
Bucky, my man you are a legend! Your talent for teaching is on the level of the Khan Academy dude. I wish you the best of success in whatever you do.
Hey, Bucky - I just want to say thanks for putting in all the work of doing this. You're an excellent teacher. I'm learning so much watching them!
@Brandlax
You can also end any loop by typing "break;" an example would be
"if (x==3) break;" then the program would get out of the loop when x is equal to 3
hi bucky,
you can avoid appearing to look to your left anytime you check to your remind yourself of what to teach by placing the monitor above the camera. That way, you will still appear to be looking at the listener (just like a teleprompter). You're awesome!
I just want to say thanks, I'm switching over from C++ which is a bit difficult since I'm used to everything being a certain way. You've made it very easy to understand. :)
These videos are great! You explain what its all about unlike most other videos.
The difference between i++ and ++i is not just personal preference. When used in code putting the ++ after the variable returns the current value and increments the variable by one. Putting the ++ before the variable increments the variable by one THEN returns the value. This is irrelevant when used in a for loop but could result in unexpected results when you try to use it elsewhere.
i++ is post increment. ++i is pre increment. For example:
int i = 3;
NSLog(@"%i", i++); // outputs 3
NSLog(@"%i", i); // outputs 4
NSLog(@"%i",++i); // outputs 5
NSLog(@"%i", i); // outputs 5
I don't think it makes any difference when used in a for loop step.
@livewithdavid I was just about to post the same thing. That seems to be a commonly misunderstood idea when someone is learning to program.
One other thing, You can do increment adjustments on characters. What it does it adds one binary digit to the letter, making it one higher. So if:
char a='a';
a++;
NSLog(@"%c",a);
you would get 'b' as your output. This can be used to change the case of a character. to make a lower case letter capital subtract 32, and vise versa.
I think for beginners it's best to separate post increment and pre increment and just write it explicitly. It will be easier to keep track.
excelllent teaching bucky just amazing anybody can easily grasp it
I know that it has been 10 years, but:
There is a difference between x++ and ++x, x++ is an expression that gives you the value of the variable and then increments it, and ++x is an expression which increments the value and *then* give it to you.
Also, increment and decrement operators work on pointers as well.
And, you should really mention that scanf, for loops, and most datatypes came from C.
%c is the wrong conversion; you need to use %s because your name, Rick, is a string. Strings are basically words, anything more than a single character is a string even though a character can be a string, but that's another story.
scanf("%s", userName);
NSLog(@"Your name is %s", userName);
Also an ampersand is not needed when your variable name is a string.
@louisdebmusic
There are equivalent functions, it's just (slightly) bad practice to use i+=1 because adding one to a variable is so common that they (the creators of objective C and C) added i++ to add 1 to the variable, the += is generally used for numbers larger than 1.
actually there is a difference between i++ and ++i;
++i is telling the computer that add one to whatever variable that is next. and i++ is saying read the variable i then then ++ will add 1 to the variable. they might sound the same but its' actually not. for instance if you do an array of array[count++]; and say count was intialise as 0; then they will look at array[0] but after that count become 1 and next array[count++] will be array[1]. array[++count] will in this case be array[1].
wow, this helped me SO much, thanks! crazy that you can't have a space there.
Thanks for all this videos bucky just wondering if you are going to get into some iphone programming that would be awesome:)
You saved my life with these tutorials. HAHA thank you! GREAT tuts!
hey bucky was up ive been watching your tutorial man i love them seriously
can you explain to me what a memory leak is at around 5:46. consequences solutions etc.
Dude you are really good...I am learning so much from you!!!
THANK YOU!!!!!!!!!!
You're awesome Bucky. Keep up the good work!
I bet you found your mistake already, but I was getting an error about it not complying with ARC as well. I had @"int" as opposed to "int"
if your using xcode 4, and when inputting your number doesn't do anything, make sure you hold down shift key and then press enter after inputting the number in the console. I was stuck on this for a few minutes.
So, you're saying that the "@" not he NSLog is for Objective-C stuff. then is it valid to use the "printf" from C instead of the "NSLog" ? and if that's the case, what are the benefits?
Thanks man, awesome video tutorials you have here.
@jljacobjl not really, printf is the c equivalent of NSLog
I had an issue entering the number. Apparently the "return" key works and the "enter" key does not. Just thought I would point it out in case anyone else had the issue. If they're the same key I think you have to hit shift.
love your tutorials, they're awesome. just a question, is there any reason to use NSLog instead of printf?
I know that this tutorial was 10 years ago, but there is. Actually there are multiple.
1. NSLog automatically adds a new line, and printf doesn't, so this can be useful for making a program like the following:
int main(int argc, const char * argv[]) {
@autoreleasepool {
for (int i = 1; i
worked it out, you can't have a space before &userNum to work in
Xcode 4 the line has to read:
scanf("%i",&userNum);
This gives the cursor
I am using Xcode 4 but when I enter in scanf("%i",&userNum); it just add 1 to what ever number I type in. example : I type 21 and it gives me 22
@Vamp2905 You put a semi colon after the for loop. There shouldn't be one there. Should be like this
... i++){
NSLog(...
So when will you be moving on to more advanced tutorials using Objective C ... as in iPhone Apps :-)
You have some nice tuts.
if you enter a letter instead of number the program will continue to add up numbers.
I wish my professors referenced bacon, they would hol my attention so much better.
Ty
char bucky;
sacnf("%i", &bucky);
: buky is a great teacher!
we love you!
it just prints the number 1 how ever many times, it doesn't inrease
YA!! I did it!! now tho you dont need to manage the memory
hahahaha you are amazing! it was so funny, i just typed 600 and my console was like OMG this guy wants to kill me
how would u prevent people from entering a letter because i put a letter to see if it was allowed and it started to count un stop so i closed Xcode
does bucky help us create iphone apps later on? are there tutorials for that?
THx
scanf wont let me enter a number in console in xcode 4, theres no cursor. It works fine in 3 though :/
what is the diffrence between printf and nslog?
I have one question....
Why if we put ";" after "for(i=1;i
@freefox12 I was just going to say this exact same thing, but it looks like you beat me to it.
bucky instead of:
i++
why can't we use
i += 1
like we did before?
please help
which editor do you use?
how do u end a for loop?
It's a C++ Language! Luckily this is similar to C++. Easier for me to learn.
Bucky,
For some reason, although I followed your code flawlessly, my code comes out with the number I input PLUS 1. Why is this? Thanks for all your help!
:D
scanf works with regular C too, right?
d/w i had a 1 instead of a i somewhere, derp
You need these "{}"
@robrulez16 Thanks a lot i knew i wasnt the only one
@freefox12 i was about to say exactly this
AND THAT WAS FUNNY
LMFAO
:)
Drop the @, add the &.
awesome scanf??? lol hackers laugh did u know it was and is vulnreable because it doesnt check the lenght