The 0 thing for octal, i ran into that in production code once and it took me at least 30 minutes to figure it out. What happened was that to align various #defines in source code so that they look pretty, someone put a bunch of zeros in front of the numbers so everything lines up in the code and starts at the same column. The code was misbehaving in a weird way. After staring at the code for 20 minutes and finding seemingly nothing wrong with it, I fired up the debugger, went through the various actions to get to the code in question (this took 10 minutes) and only in a debugger after loading the value and seeing the wrong value in memory, by seeing what the value loaded was, I immediately realized it must be interpreting it as octal. I will never forget this! Hex is 0x, Binary is 0b, why not 0o for Octal? I love C++ (I know this is C) but having a plain zero mean octal is just insane...
It was a resolutely stupid decision for C designers to try to mangle actual math that way. In fact it's a design choice literally forcing C code to be 'bad code' by hiding bugs in plain sight. Anyone that I see doing those things in code-reviews gets mandatory C tutorial reassignments where I work.
@@jainsahab8549 i saw that channel after you said bhai, it is also very good. in my opinion, neso academy teaches you from very basic(i does not mean that other channels doesn't teach good)but other channels teach good for students who already know basics of c language . i am 12 years old, before starting this course i don't a inch about c language, but because of neso academy even without knowing the basics, i understand each and every point sir tell. this is my opinion , now you can choose what is best for you. if you know basics, go for ravindra babu ravula, but if you want each and every point clearly from basics, go for neso academy. i hope this helps you😁😁
what is the output for this c program? #include #define STRING "%s " #define NESO "Welcome to Neso academy" int main() { printf(" Welcome to Neso Academy! " STRING, NESO ) ; return 0; }
I think when 52 octal is written with %o, it's not fortunate to pronounce the displayed 52 as fifty-two. It's misleading, especially for the beginners. That number has nothing to do with the number we know as the sum of five times ten plus two times one. It's just "five-two (octal)".
I would like to say thank you so much to nesho academy . I could not understand in my college during first year when i found this channel then i have been started learning c language and after watching all videos i have become as like master of c so once again thank u so much sir jee love u to all faculties of nesho academy
Comment for myself: putting 0 in front of an integer variable translates that number into an octal value. This is true if the variable is to be printed as a decimal. If it's "%o", and the value is an octal, then it prints normally.
When a string is made in c programming it is made as an array of characters, including the spaces, and finished with null ('/0'). Printf reads the string with %s to this null character and thats its indication that it is done printing. So i does not end on a whitespace but rather a null character
Sir i think that is compiler error becoz to print "welcome to neso academi!" No need of use %s .sir plz clarify my doubt If we want use"℅s " the 2nd parameter should be NESO only dont want to replace with "welcome to neso academi!".then only the string will be printed in the o/p otherwise it raise an error.
yea, except the compiler made mitigation for it. which still makes it a compiler error. i hate it when a question gives that "error" option but didn't think it through
I found your discussion of octal numbers interesting as I didn't know any of that! Unfortunately, I have no real need to ever use octal numbers but I do have frequent needs to use binary numbers. I know that 0xFF is hexadecimal 'FF' = 255, and now I know that 052 is octal '52' = 42, but can we do similar with binaries? "%b" seems not to work when I have tried it. Is there a method to format binary numbers in this way?
Sir, the last question is regarding the macro substitution. After substitution, the printf() be like printf(%s , welcome to neso academy). As per the syntax of printf(), Shouldn't we write the control strings in double quotes like printf("%s ", welcome to neso academy);? Then won't it show compiler error?
I used printf, scanf and again printf function in a one line it give a correct output but the function are not work correctly Ex:printf("enter the two no",scanf("%d%d",&a, &b,printf(c="%d",a+b))); Output:it firstly take two number after it used display function and then it give the output which is correct I want to know that why it take two no. First and display and it give Final output
NESO is a macro that expands to the string "Welcome to Neso Academy!". Remember we can declare a string with something like char *str = "Hello world", in which case the " " do not stay. It is the same here, NESO is only the declaration of the string, and what's in it doesn't include the " ".
You’d need to escape the quotation marks with \ to have them printed, therefore the string to print should be something like “\”content\”” to have “content” as output.
Because you might have been using number containing 9 which is outside the scope of octal. Try using 56 , 47, it will work . If you use 49 or 48 it won't work and show this error.
The 0 thing for octal, i ran into that in production code once and it took me at least 30 minutes to figure it out. What happened was that to align various #defines in source code so that they look pretty, someone put a bunch of zeros in front of the numbers so everything lines up in the code and starts at the same column. The code was misbehaving in a weird way. After staring at the code for 20 minutes and finding seemingly nothing wrong with it, I fired up the debugger, went through the various actions to get to the code in question (this took 10 minutes) and only in a debugger after loading the value and seeing the wrong value in memory, by seeing what the value loaded was, I immediately realized it must be interpreting it as octal. I will never forget this! Hex is 0x, Binary is 0b, why not 0o for Octal? I love C++ (I know this is C) but having a plain zero mean octal is just insane...
It was a resolutely stupid decision for C designers to try to mangle actual math that way.
In fact it's a design choice literally forcing C code to be 'bad code' by hiding bugs in plain sight. Anyone that I see doing those things in code-reviews gets mandatory C tutorial reassignments where I work.
Such a valuable knowledge sir I didn't know that before truly speaking
sir
Ss
Love you Neso Academy ❤
Edit : I hope you know how much easy you are making an engineering student's life !!! Thanks a million !!!!
How should I get the complete series of this from starting. I have get only single videos of different series no.
Please help me to get this series. 🙏
@@sanmatipol3201 search Neso Academy c programming,you will get neso academy playlist containing 226 videos.hope this helps you😀😀
@@Jkt61205 bhai tell me which is best between ravindra babu rabula vs neso academy
@@jainsahab8549 i saw that channel after you said bhai, it is also very good. in my opinion, neso academy teaches you from very basic(i does not mean that other channels doesn't teach good)but other channels teach good for students who already know basics of c language . i am 12 years old, before starting this course i don't a inch about c language, but because of neso academy even without knowing the basics, i understand each and every point sir tell. this is my opinion , now you can choose what is best for you. if you know basics, go for ravindra babu ravula, but if you want each and every point clearly from basics, go for neso academy. i hope this helps you😁😁
@@Jkt61205 Okk bro..Thanks for Suggestion.
Woh. That’s something I don’t know before. Great logic.
Well, the real quality education is here. I really appreciate you all. Thanks a lot from Myanmar❤️
nice video and lesson, has increased my understanding of C language
0:53 0 before integer is treated as an octal value
what is the output for this c program?
#include
#define STRING "%s
"
#define NESO "Welcome to Neso academy"
int main()
{
printf(" Welcome to Neso Academy! " STRING, NESO ) ;
return 0;
}
Sir your teaching style is awesome 🥰🥰
Question series is the best parts ever sir and thanku .........
Where from can I get the Q&A series.. Can you tell me please 🙏
I think when 52 octal is written with %o, it's not fortunate to pronounce the displayed 52 as fifty-two. It's misleading, especially for the beginners. That number has nothing to do with the number we know as the sum of five times ten plus two times one.
It's just "five-two (octal)".
Best part of the videos is the explanation 💖💖for all the answers which arent provided by other channels; ❤❤
You're doing a great job explaining this stuff! ^^
I thought it would be a compile error, for printf won't be found. But it's just a warning without #include
Which one is better neso or code with Harry.
A) neso
B) code with Harry
neso academy.. thanks.. these questions were very tricky indeed
please add content like computer algorithm, compiler construction, Computer
Organization and Architecture, Machine Learning
The questions were very good and I really enjoyed it.
I would like to say thank you so much to nesho academy .
I could not understand in my college during first year when i found this channel then i have been started learning c language and after watching all videos i have become as like master of c so once again thank u so much sir jee love u to all faculties of nesho academy
Comment for myself: putting 0 in front of an integer variable translates that number into an octal value. This is true if the variable is to be printed as a decimal. If it's "%o", and the value is an octal, then it prints normally.
Its a valuable knowledge I did not know this basicbknoweldge
Your channel is just awesome ....
Excellent questions and well explained answers, thanks.
Awesome ..... I m now totally interested in the subject
Please upload "analog and digital communication"
Sir, from where you get such amazing questions!!
please suggest a book from where we can practice quetion and test our knowledge.
waaaw what a great video...
2:34 Why is there no need of #Include ?
Thank you sir for giving a meaningful information ..
Sir can you make videos on java
I think "%s" prints the string as long as it gets a space.....so the answer should be Welcome only......plz correct me if I am wrong.
When a string is made in c programming it is made as an array of characters, including the spaces, and finished with null ('/0'). Printf reads the string with %s to this null character and thats its indication that it is done printing. So i does not end on a whitespace but rather a null character
its very important to note the difference between a whitespace character (' ') and a null character ('/0')
love you neso academy
Thanks for the like man means a lot please help us with more videos or a complete tutorial session
Q1 ---42 o decimal values
Sir please make tutorial on TCL/TK no you tuber uploaded the video regarding TCL
Sir i think that is compiler error becoz to print "welcome to neso academi!" No need of use %s
.sir plz clarify my doubt
If we want use"℅s
" the 2nd parameter should be NESO only dont want to replace with "welcome to neso academi!".then only the string will be printed in the o/p otherwise it raise an error.
No it will work because NESO is actually string because in its definition its written in " ".
videos are awesome❤❤😍😍 . Please make more videos on each topics. 👍👍
thank you brother
Excellent video
The first problem would actually cause a Compiler error, because the include for stdio is not there
yea you right hahah
not compile error, but a warning
@@vmod3985 Yeahh Compiler warning, linker error I believe
yea, except the compiler made mitigation for it. which still makes it a compiler error. i hate it when a question gives that "error" option but didn't think it through
doesn't it depends on whether you wrote -Werror or not if you run your program with a terminal ?
Very useful for us
.. thanks for posting
Tq sir wounderful collection of questions
In code blocks v 20.03 it shows compilation error for the octal value questions..even with %o
#include
#define STRING "%s
"
#define NESO "Welome to Neso "
int main()
{
printf(STRING);
return 0;
}
OUTPUT
PE //WHY !!
2:06
3:17
5:45
sir make video on various keyword used in c like enum function
Good explanation
Your contents are amazing 🥰🥰🥰.
I found your discussion of octal numbers interesting as I didn't know any of that! Unfortunately, I have no real need to ever use octal numbers but I do have frequent needs to use binary numbers. I know that 0xFF is hexadecimal 'FF' = 255, and now I know that 052 is octal '52' = 42, but can we do similar with binaries? "%b" seems not to work when I have tried it. Is there a method to format binary numbers in this way?
No you will need to write a function to convert binary to decimal
@@dddddddddddddddadddddddddddddd OK, thanks
Thanks sir for this video
Thanks a lot
Excellent
Sir,
the last question is regarding the macro substitution. After substitution, the printf() be like printf(%s
, welcome to neso academy). As per the syntax of printf(), Shouldn't we write the control strings in double quotes like printf("%s
", welcome to neso academy);? Then won't it show compiler error?
I got the same doubt too..
Very useful.. thanks
We love you Neso
Awesome questions man!
Sir, when we place 0 in front of any decimal number then it is treated as an octal number. Is there any other case for hexadecimal number????
0x1F is a hexadecimal value
@@frit00701 okay
@@tannishthasengupta7353
Binary number = 101010
Octal number = 052
Decimal number = 42
Hexadecimal number = 0x2A
Sir microprocessor ke upar video banao please
Really awesome tq
Hindi m bhi btaya kariye sir
U r the best teacher..
Super video bro
Very good tricks thank you...
56
very nice sir👌
u are really awesome sir
Thank you sir
Tq this video is very useful
Bro we use reference operator before the printf variable
Only for variables not macros
He made a mistake on the first question, but on the other ones it's not used because the parameters are accessing a macro definition. Not a variable.
No printf doesn't require the address of the variable, but scanf does
It was helpful
totally liked it
Will it be important for gate prep too??
I used printf, scanf and again printf function in a one line it give a correct output but the function are not work correctly
Ex:printf("enter the two no",scanf("%d%d",&a, &b,printf(c="%d",a+b)));
Output:it firstly take two number after it used display function and then it give the output which is correct
I want to know that why it take two no. First and display and it give Final output
What
so this was the program the computer in Hitchhiker's Guide was running?
Thank u
sr hw it is octal value?
*WHY ON EARTH DID I GET THAT IN MY RECOMMEND LIST?*
BTW THANKS FOR THE FACTS
Nice video 😲
Sir but you told that printf not only prints the string but it also prints the noof characters on the console screen in previous videos
Spr clarity..it's really very understandable☺..plz make the videos in c++,java programs also
Completely impressed keep continue sir luv u
Very easy
Well, I thought scanf() and printf() won't Handel multi-word string that's why we use puts() and gets() if wrong please correct me 😇😇😇....
Printf can handle multiple words only scanf cannot
So basically what I'm thinking can never be the answer, then I'm left with three options, Alright!!!
Thank u very nice
Wow do more videos in c programming or c ++
Super sir u rocking
I need help to use the float option in different ways
Sir u guys are best
I learnt new thing from your video for 1 st one and I want some more about 2nd one why double quotes are not printing.
Waiting for your valuable reply
NESO is a macro that expands to the string "Welcome to Neso Academy!". Remember we can declare a string with something like char *str = "Hello world", in which case the " " do not stay. It is the same here, NESO is only the declaration of the string, and what's in it doesn't include the " ".
You’d need to escape the quotation marks with \ to have them printed, therefore the string to print should be something like “\”content\”” to have “content” as output.
@@marekziba Thanks Brother I was looking for this....
In q2 what should one do to get the answer as b ?
Thks ...sir
Neso 😍😍😍❤❤❤❤❤ur amazing guys. Thanks a lot.I hope u upload all gate subjects.
Sir suppose there is no zero,think that value 052 place is replacing with just 52 than the value is 52.if the octal is not it here possible.
Yes
Even after specifying %o .......... It's throwing an error
error: invalid digit "9" in octal constant|
Because you might have been using number containing 9 which is outside the scope of octal.
Try using 56 , 47, it will work . If you use 49 or 48 it won't work and show this error.
Octal number system has Radix 8 that means the distinct digits are 1 to (radix-1) then how will you use 9
Sir, what I do for hexadecimal??
Use.16
0x
Pls give video for aptitude questn solve
In the last question s is used for print string so why they not print no. Of string character
Wow. I knew the answer from thumbnail BTW.
how do we know that it is octal only??
really great plls go ahead like this type of videos
This is good enough , help me a lot, upload more material as like it.
But how can we know the question 1 is based on 8?