If you print x it will give you 1 for int, and 1.000000 for float. But it all depends to the amount of format specifiers you have in scanf. If you have 3 format specifiers, then x will be 3. Thanks very much mam. May God bless.
11:27 The comma act as a separator there. 19:30 The output for x will be 2 if we write , scanf("%d" , &a , &b) ; sum will be give some garbage value 😂 and x will give 1. if we write , scanf("%d %d %d" , &a , &b) ; It will get the input from user but will not return any value for sum or x.
Mam you are the great teacher and explains all the topics clearly without any doubt very well I am beginner for this subject because I am student of computer science and engineering
x = scanf("%d %d",&a,&d); x has 2 y = scanf("%d",&b,&e); y has 1 with warning - too many arguments z = scanf("%d %d %d",&c,&f); warning - %d expects int argument After giving input, then goes to segmentation fault!
(^)- this symbol is called circumflex. Normally if %[ ... ] is used then scanning is done till whatever(here, ...) is written inside the 3rd bracket is found in input. The scanning gets stopped just the moment when any character outside “...” this range is found. For instance, Say char x[]=“hello”; printf(“%s ”,x); scanf(“%[abcd]”,x); printf(“%s ”,x); Here, in test case #1. cadbcadbaefgchs Output : _________ hello cadbcadba #2. jkalehcd Output : ________ hello hello Why? In T#1 the scanf function scanned(and replaced the original string “hello”) our input string till it found [abcd] in the input string “cadbcadbaefgchs” and just when it encountered a letter outside the range [abcd], in this case, it is ‘e’, it stopped scanning and put ‘ ’ at the end. So after scanning x[]=“cadbcadba”. In T#2 the first character scanf encounters is ‘j’ which is out of [abcd] range so it doesn’t scan and replace original string “hello” at all and hence x remains x[]=“hello”. NOW Whenever we use circumflex(^) here, i.e. %[^...] , it tells scanf to scan anything unless anything from (...) portion is encountered. As soon as any character/digit from (...) portion is encountered, scanf will stop scanning and put a ‘ ’ and end the string right there. For instance, for T#2 now if we modify the code to char x[]=“hello”; printf(“%s ”,x); scanf(“%[^abcd]”,x); printf(“%s ”,x); our output will (lemme remind I am writing the output for T#2, if you understand what I am blabbering here, you may reply what you think will be the output for T#1 in the comment section :3) Output for T#2 ________________ hello jk Why? The scanf function scanned upto “jk” but then it encountered ‘a’ which belongs to [abcd] range and this time as we have used “^” before [abcd] our scanf will not scan anything from this range and if it encounters a/b/c/d it will stop scanning. And that’s what happened when it encountered ‘a’ after scanning “jk”; it stopped scanning further and replaced “hello” with “jk”. I know this was a whole lot of blabbering :3. But now can you figure out how “[^ ]” works? PAUSE & THINK HINT : ---
indicates a new line(simply, enter key). So when we are using ^ we are indicating keep scanning the string till you encounter a new line and don’t stop before you encounter new line. So when you are entering HELLO WORLD.(new line/enter key) I AM AN ALIEN.(newline/enter key) Your code keeps scanning the string till it finds the first new line which is after “.” Of “HELLO WORLD.” and then stops scanning and prints “HELLO WORLD” For instance, now if we modify the earlier code as char x[]=“hello”; printf(“%s ”,x); scanf(“%[^ ]”,x); printf(“%s ”,x); and if you give input : Input: --- HELLO WORLD. I AM AN ALIEN. Output : ---- hello HELLO WORLD.
@@Prajwal.Suresh I am also a first year student bro 😂 DW! Search and Read a little more about it and I am sure you will understand it. At first when my professor told us about it I didn’t also get it but at the end HAD to understand it as he compelled us 😕.
I wil send u gift mam tel me &jenny printf(“address of jenny “);& scanf( “phne number”) 🤣😛 Never got e perfect-brainer lecturer as u In my entire btech 👍👏👌u teach concepts so clear of any confusion & perfectly wit examples & accurate on piont wit its realtime use great 👏✌️
scanf("%f", &a); requires an address of a float variable to be passed to it. Replace the keyword int with float in your program's source code. Recompile it and run it. You can also declare 'a' as a double variable and modify the %f format specifier to %lf. The reason your program printed some garbage value is because floating point values are stored in a completely different format (IEEE-754 standard) in the computer's memory than the regular whole number types like short, int, long, long long.
@@atib1980 Thanks for the info...I voluntarily did the mistake because mam told us if we try to print the integer value using the float format specifier, it will print 0 but it actually prints garbage value. It isn't an issue?
@@syedalifathimaa9618 #include int main() { int a = 10; scanf("%f", &a); printf("a = %f ", a); return 0; } The reason why it's printing garbage value is because you're trying to read a floating point value (%f) into a local variable of type int (a variable of type int is stored in a completely different way than a variable of a standard floating type (float, double or long double are represented in the computer's memory using the IEEE-754 standard) and when you try to print the value of local variable 'a' (int) using the %f format specifier the program will again print the same garbage value that you tried to store into the local variable 'a' (int) using scanf with "%f". Now depending upon which compiler you use to compile this simple program, you will get different results. gcc and clang will always print 0 even if you specify a bunch of flags for various types of compile and link-time optimizations. The only compiler that behaved differently was the Visual C/C++ compiler from Microsoft. With MSVC (cl.exe /nologo /W4 /Fetest simple.c) I managed to print some garbage value as a result of compiling and running the aforementioned simple program (simple.c). Compiling simple.c using the MS Visual C/C++ compiler 'cl.exe' I always ended up getting some garbage value with or without explicitly initalizing the local int variable 'a' to some predefined value (int a = 10;). But when I compiled the program with various optimization flags (/O2 /Ot /Ox /Ob2 /Oy /Oi) turned on, the compiled program behaved the same way as if I'd compiled it with gcc or clang, giving me the same 0 value as ouput. My conclusion is that the MS VC/C++ compiler will always print 0 for an int value using printf("%f ", a) no matter what you read into the int variable using scanf("%f", &a). In fact after debugging the compiled programs in Ollydgb and Ida pro I noticed that the scanf("%f", &a) statement in the compiled programs that I got using gcc (with or without optimization flags enabled), clang (with or without optimization flags enabled) or MSVC with various optimization flags turned on didn't even modify the variable's value ('a'). It stayed the same (10). However when the program tried to print an integer value using printf("%f ", a), it printed 0 instead of 10.
Polite speaking to deliver lecture with soft voice.I'm glad to listen the topics.
Love you nice teacher for me.
She deserves more likes 🥺 and even she is not asking for that
I have been following through your c programming course and I'm impressed by your clear and concise explanation.THANK YOU JENNY
Mam please give a ❤️ to.this comment I watch ur lectures daily plsss plss mam
If you print x it will give you 1 for int, and 1.000000 for float. But it all depends to the amount of format specifiers you have in scanf. If you have 3 format specifiers, then x will be 3.
Thanks very much mam. May God bless.
float will give only 1.00000 after dot 5 digit only sir
11:27
The comma act as a separator there.
19:30
The output for x will be 2
if we write ,
scanf("%d" , &a , &b) ;
sum will be give some garbage value 😂 and x will give 1.
if we write ,
scanf("%d %d %d" , &a , &b) ;
It will get the input from user but will not return any value for sum or x.
Very thanks 😊
???
11:22
comma is acting as a *separator*
19:11
X will be assigned with 2 madam
How 2 will come explain?
Operater
2 formatt speciers
Have just started Function in C programming. All thanks to Mam✍
unbeatable playlist of c language ,ever found in youtube learning c from this playlist in 2023
17:35 2
18:15
#include
int main()
{
int a,b,x;
x=scanf("%d",&a,&b);
printf("%d",x);
return 0;
}
output:
17 18
1
#include
int main()
{
int a,b,x;
x=scanf("%d %d %d",&a,&b);
printf("%d",x);
return 0;
}
output:
12 13 14
--------------------------------
Process exited after 8.303 seconds with return value 3221225477
Press any key to continue . . .
Mam ur teaching way is superb my request for you to make lectures on python also 🙏
Ma'am communication skills and attitude op 😍😍😍
Mam you are the great teacher and explains all the topics clearly without any doubt
very well I am beginner for this subject because I am student of computer science and engineering
x value will be 2 and that means the number of format specifier you taking the user input using them.
You are such a fabulous teacher
I am easily able to learn because of you
Thank you mam and please support us like this 😊
MA'AM you r teaching method is very nice THANKS FROM PAKISTAN
'x' here, will return the number of inputs taken by the scanf() function.
And no other errors in any other case.
x will give the total of "control string", %d %d %f %s total value of X is 4...
When legend teachers get their mistake they says" I am checking that you are attentive or not"😁
But mam you are a awesome teacher
Loved it ❤
I m really thankful to you mam...Your way of explanation again and again I love it...You are really great mam..💯
Hi
Watched and Understood ❤
mam one thing about is ur a " more then pro ".........🤩
Ma'am u gone to core amazing maam
very nice explain 😊
(11.22)-comma is a separator mam
Hi mam your lecture is very clear than our college lecture
Ma'am can you just make videos on Embedded C ? It might very useful for us
Thanks for your explaination
Thanks a bunch...
Thankyou maya love from Nepal
19:08 output will be 2
Can you plz explain how we are getting x=2
I kindly Request . To Pls Make Videos on Python As soon as possible mam ❤️ . Because we are Addicted to u 🙏☺️
See This Playlist : ua-cam.com/play/PLl2gq7invFLBhXOhUaBOX0dJ3r1eIpJpT.html #techblooded
@@aniketthorat9732 thank you 👍🥺✨
Mam please continue DBMS and operating system mam , please...
Nice explain mam
Tqq Mam.
i saw the eror before you told mee
😊😁
Super madam explain nice madam
Mam is so beautiful😍
Mam please upload towers of honoi problem using data structures
Thank you mam ❤
Mem your looking very beautiful that’s why I’m watching your video ☺️
I kindly request to please make videos on c programming function as soon as possible mam🙏.🎉
11:20 comma is acting as a seperator
Mam can you make a video for user defined functions in which function call is there
You can watch my videos bro for that information
Nice
Thanks a lot Mam
First comment😍😍😍😍😍
Keep all videos at a single place difficult to search
nice 👍
5th comment
Nice 👍
@@vivekprasad_official_music2267 nahi nai ye kya h.. mene pucha kya comment me link diya apne...
𝕸𝖆𝖒 𝕻𝖗𝖔𝖏𝖊𝖈𝖙𝖘 𝖇𝖍𝖎 𝖇𝖆𝖙𝖆𝖓𝖆 𝕱𝖔𝖗 𝖎𝖓𝖙𝖊𝖗𝖓𝖘𝖍𝖎𝖕 𝖑𝖊𝖛𝖊𝖑.
thankyou mam🙏
Mam, SQL ki full fom structure query language hoti h.. kya kisi condition me iski full form standard query language ho skti h ya nahi....
Mam in the programm ,if i use only main() instead of void main() it is getting error why?
Thank you mam
Mam when i want to use void main and int main
Ma'am please upload videos of pointers, structure, union, enum, files handling, command line argument in c
2:22 ad ends
Mam plz make a vedio lecture series on Adavanced Algorithm design you uplaoded the vedios on algorithm but plz upalod remaining lectures on Algorithm
we need more
🔥🔥🔥
Gr8
I got the error 😂😂😂
Video starts 2:23
x = scanf("%d %d",&a,&d); x has 2
y = scanf("%d",&b,&e); y has 1 with warning - too many arguments
z = scanf("%d %d %d",&c,&f); warning - %d expects int argument
After giving input, then goes to segmentation fault!
put integer value
mam scanf(int=d,float=f ,char=c why float= f and char c but int=i but we have use d yyyy???
Without declaration int main
Program isn't running
Mam are you taking course for c,c++ and java
Hi bhoo devi
Mam please upload the video for pointers
Mam aap ko dekhne ke baad class pe man nehi lag raha hey😅😅😅😂
Really thAnks
Comma is used as a operator mam...???
11:20
Mam Hindi medium walo ko bhi pdaya kariye
The x gives the number of operands taking part in the sum function
Comma is acting as a separator in scanf() mam
After adding x it is not giving us a garbage value
In this scanf() function we can skip some input using* symbol plz explained with examples
Can I use Blankspace between "control/conversion string"??
how to read the scanf function body
Mem live class kab lagti hai aapki
Is it mandatory to use ampersand in scanf() ? Because i have noticed no error occours if we omit ampersand
2:23
Mam why can't we use only printf
1st view
, is working as seprator
I am getting -1 for X=scanf("%d%d",&a,&b);
Printf("%d",X);
Me too
Can you tell about [^
] in scanf and %*c and %[^
]%*c in scanf plss 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
(^)- this symbol is called circumflex.
Normally if %[ ... ] is used then scanning is done till whatever(here, ...) is written inside the 3rd bracket is found in input. The scanning gets stopped just the moment when any character outside “...” this range is found.
For instance,
Say
char x[]=“hello”;
printf(“%s
”,x);
scanf(“%[abcd]”,x);
printf(“%s
”,x);
Here, in test case
#1. cadbcadbaefgchs
Output :
_________
hello
cadbcadba
#2. jkalehcd
Output :
________
hello
hello
Why?
In T#1 the scanf function scanned(and replaced the original string “hello”) our input string till it found [abcd] in the input string “cadbcadbaefgchs” and just when it encountered a letter outside the range [abcd], in this case, it is ‘e’, it stopped scanning and put ‘
’ at the end. So after scanning x[]=“cadbcadba”.
In T#2 the first character scanf encounters is ‘j’ which is out of [abcd] range so it doesn’t scan and replace original string “hello” at all and hence x remains x[]=“hello”.
NOW
Whenever we use circumflex(^) here, i.e. %[^...] , it tells scanf to scan anything unless anything from (...) portion is encountered. As soon as any character/digit from (...) portion is encountered, scanf will stop scanning and put a ‘
’ and end the string right there.
For instance, for T#2 now if we modify the code to
char x[]=“hello”;
printf(“%s
”,x);
scanf(“%[^abcd]”,x);
printf(“%s
”,x);
our output will (lemme remind I am writing the output for T#2, if you understand what I am blabbering here, you may reply what you think will be the output for T#1 in the comment section :3)
Output for T#2
________________
hello
jk
Why?
The scanf function scanned upto “jk” but then it encountered ‘a’ which belongs to [abcd] range and this time as we have used “^” before [abcd] our scanf will not scan anything from this range and if it encounters a/b/c/d it will stop scanning. And that’s what happened when it encountered ‘a’ after scanning “jk”; it stopped scanning further and replaced “hello” with “jk”.
I know this was a whole lot of blabbering :3. But now can you figure out how “[^
]” works?
PAUSE & THINK
HINT :
---
indicates a new line(simply, enter key). So when we are using ^
we are indicating keep scanning the string till you encounter a new line and don’t stop before you encounter new line. So when you are entering
HELLO WORLD.(new line/enter key)
I AM AN ALIEN.(newline/enter key)
Your code keeps scanning the string till it finds the first new line which is after “.” Of “HELLO WORLD.” and then stops scanning and prints “HELLO WORLD”
For instance, now if we modify the earlier code as
char x[]=“hello”;
printf(“%s
”,x);
scanf(“%[^
]”,x);
printf(“%s
”,x);
and if you give input :
Input:
---
HELLO WORLD.
I AM AN ALIEN.
Output :
----
hello
HELLO WORLD.
@@farzanareefatraha8635 Thankyou very much bhaiya 👍👍🥺🥺
@@farzanareefatraha8635 😶 i am first year student and understand only little bit in this bro
@@Prajwal.Suresh I am also a first year student bro 😂
DW! Search and Read a little more about it and I am sure you will understand it. At first when my professor told us about it I didn’t also get it but at the end HAD to understand it as he compelled us 😕.
@@farzanareefatraha8635 ok bro 🙄
❤❤❤❤
mam real examples k sath illustrate kia kijiye pls
Comma acts as a separator
Mam, can i use scanf without & if my variable is a pointer ?
example:
int*a;
scanf("%d",a);
I think in this case it will give the address of the variable a. I am not sure though.
comma is acting as a separator
Yes mam we have got your error before you told us
Medam is it true presently every one following ANSI C language?
here the value of x is 2 same as how many times scanf takes input from user.
I wil send u gift mam tel me &jenny printf(“address of jenny “);& scanf( “phne number”) 🤣😛 Never got e perfect-brainer lecturer as u In my entire btech 👍👏👌u teach concepts so clear of any confusion & perfectly wit examples & accurate on piont wit its realtime use great 👏✌️
Yes ma'am I got error😂
int a;
scanf("%f",&a);
but when I'm printing a, it is showing some unwanted number, not 0.....can anyone tell me about it?
scanf("%f", &a); requires an address of a float variable to be passed to it. Replace the keyword int with float in your program's source code. Recompile it and run it. You can also declare 'a' as a double variable and modify the %f format specifier to %lf. The reason your program printed some garbage value is because floating point values are stored in a completely different format (IEEE-754 standard) in the computer's memory than the regular whole number types like short, int, long, long long.
@@atib1980 Thanks for the info...I voluntarily did the mistake because mam told us if we try to print the integer value using the float format specifier, it will print 0 but it actually prints garbage value. It isn't an issue?
@@atib1980, Can you tell me why it's printing garbage value instead of 0?
@@syedalifathimaa9618 #include
int main() {
int a = 10;
scanf("%f", &a);
printf("a = %f
", a);
return 0;
}
The reason why it's printing garbage value is because you're trying to read a floating point value (%f) into a local variable of type int (a variable of type int is stored in a completely different way than a variable of a standard floating type (float, double or long double are represented in the computer's memory using the IEEE-754 standard) and when you try to print the value of local variable 'a' (int) using the %f format specifier the program will again print the same garbage value that you tried to store into the local variable 'a' (int) using scanf with "%f". Now depending upon which compiler you use to compile this simple program, you will get different results. gcc and clang will always print 0 even if you specify a bunch of flags for various types of compile and link-time optimizations. The only compiler that behaved differently was the Visual C/C++ compiler from Microsoft. With MSVC (cl.exe /nologo /W4 /Fetest simple.c) I managed to print some garbage value as a result of compiling and running the aforementioned simple program (simple.c). Compiling simple.c using the MS Visual C/C++ compiler 'cl.exe' I always ended up getting some garbage value with or without explicitly initalizing the local int variable 'a' to some predefined value (int a = 10;). But when I compiled the program with various optimization flags (/O2 /Ot /Ox /Ob2 /Oy /Oi) turned on, the compiled program behaved the same way as if I'd compiled it with gcc or clang, giving me the same 0 value as ouput. My conclusion is that the MS VC/C++ compiler will always print 0 for an int value using printf("%f
", a) no matter what you read into the int variable using scanf("%f", &a). In fact after debugging the compiled programs in Ollydgb and Ida pro I noticed that the scanf("%f", &a) statement in the compiled programs that I got using gcc (with or without optimization flags enabled), clang (with or without optimization flags enabled) or MSVC with various optimization flags turned on didn't even modify the variable's value ('a'). It stayed the same (10). However when the program tried to print an integer value using printf("%f
", a), it printed 0 instead of 10.
@@atib1980 Thanks....It's really helpful, may I know who you are?
comma is acting as separator
ma'am aap lockdown me moti ho gaye ho :)