Variables Declaration and Usage in C Programming | Video Tutorial

  Рет қаралды 380,790

LearningLad

LearningLad

Күн бұрын

Пікірлер: 189
@DeyvesshKumar
@DeyvesshKumar 9 жыл бұрын
I want to thank you sir, Your tutorials are helping me with my studies. Earlier I didn't know What is C. but when it came to my syllabus then I started watching your tutorials. It really helped me to understand than compared to other tutorials... Now I am on 15th chapter and I know, When I will reach to 139th. It will be a big blow to me... Thank you, Sir...
@nangng9855
@nangng9855 9 жыл бұрын
Thank you, this'll help me a lot in my classes. Maybe you could have subtitles..for people like me who has hearing problems..
@LearningLad
@LearningLad 9 жыл бұрын
no hEal yup! Some of our initial video's have very low volume level. We will try to add subtitles AEAP. Thank you :)
@jeffersoncobbina2989
@jeffersoncobbina2989 4 жыл бұрын
I'm proud to get you bro👍
@pinklady7184
@pinklady7184 7 жыл бұрын
Many thanks for your tutorials.
@developerstimes739
@developerstimes739 4 жыл бұрын
Good Mr. Anil
@LearningLad
@LearningLad 4 жыл бұрын
Thank you :)
@ravi7619
@ravi7619 9 жыл бұрын
Dear Anil, Your videos are very helpful to beginners and non-techies :) I have 2 questions based on this lesson: 1/ when i mention weight as 60.3, the output displayed is 60.299999 - why is this so? 2/ why can't we use 'male' instead of 'm'. Thank you
@ravi7619
@ravi7619 9 жыл бұрын
+LearningLad
@LearningLad
@LearningLad 9 жыл бұрын
+Ravi Iyer can u pls provide the source codeso that i can check for 60.2999999 as for as your 2nd question is considered, In a character variable, we can store one character. 'm' is a single character, so we can store it in a character variable. "male"' contains more than one characters and it is considered as a string. so we need to use character arrays to store them and you will learn about them later in this video series.
@ravi7619
@ravi7619 9 жыл бұрын
+LearningLad Thank you. Here's my code (I face this issue with all decimal nos.) #include #include int main() { int age; float weight; char sex; age=28; weight=32.8; sex='M'; printf("%d %f %c", age, weight, sex); getch(); return 0; }
@amitgradient1
@amitgradient1 10 жыл бұрын
Nice Video Anil. Can you share a video about installing C compiler for iOS or share any link, if you know of one.. Thanks
@jayasree2669
@jayasree2669 6 жыл бұрын
sir instead of int main...can we use void main...if at all we can use what is the difference between them
@amritkumarbehera9631
@amritkumarbehera9631 6 жыл бұрын
Thank you very much
@LearningLad
@LearningLad 6 жыл бұрын
my pleasure :)
@priyagupta5081
@priyagupta5081 8 жыл бұрын
if there Isn't anything to return, can we use void main() here?? plz reply
@sunilpatil8144
@sunilpatil8144 8 жыл бұрын
yes you can :)
@anandpathik
@anandpathik 9 жыл бұрын
Hello friend, I am quite new. And I am enjoying learning through your lessons. I am having a problem, I wrote all the programming seeing your video but when I run the program age, weight, sex is 0, 0.0000, and a symbol. help me plz
@Deathvveeps
@Deathvveeps 9 жыл бұрын
Vikas Kumar I too, followed this to the letter, read over it and yet again I get a random number for my age with up to seven numbers, 0.0000 for my weight, and my sex is an odd symbol...but the screen displaying the words "age,weight,sex" appear just fine. Any reason as to why?
@Deathvveeps
@Deathvveeps 9 жыл бұрын
Vikas Kumar Okay so this should work, we forgot to call the variables, you probably have something like this: printf (" %d %f %c, age, weight, sex"); WRONG printf (" %d %f %c, age, weight,sex", age, weight, sex); RIGHT ^^^^^right above, calling the variables age, weight, sex. I'm new to this as well, but that is all I could come up with...I think this is right.
@Steve01ification
@Steve01ification 9 жыл бұрын
+Deathvveeps printf (" %d %f %c", age, weight,sex);
@sujanthapa9365
@sujanthapa9365 9 жыл бұрын
you may have used - instead of = while assigning value
@telugumemeworld4476
@telugumemeworld4476 7 жыл бұрын
when i compiled and run the programme the out put is showing "hello learner" which we did in the first programme i did this programme exactly as u said but only the output is differing plzz help
@sreekumark8877
@sreekumark8877 7 жыл бұрын
great video sir.how much hour should I spend for studying programming,
@LearningLad
@LearningLad 7 жыл бұрын
dont calculate timings. if you are interested then just start learning.
@koishikisskogasa
@koishikisskogasa 3 жыл бұрын
I have been 3 days of learning basic now imma make web from c
@UNKNOWNKINGTHEGAMER
@UNKNOWNKINGTHEGAMER 7 жыл бұрын
when I compile it and run it says Error Id returned 1 exit status Now, what should I do?
@harshavardhanupputuri6211
@harshavardhanupputuri6211 7 жыл бұрын
Sir pls can u explain the diff between studio.h nd conio.h can't studio.h provides the functions to pause the program
@tejaswinireddy2942
@tejaswinireddy2942 9 жыл бұрын
hello sir i am new to this c programing i am geting you of what u said but the one i am not understanding is how ur leaving the numbers n keeping the brackets how can it done? means how will we know to put like that the brackets
@LearningLad
@LearningLad 9 жыл бұрын
Tejaswini Reddy i'm sorry. i'm not getting your question. can you post more info???
@jobforj
@jobforj 9 жыл бұрын
+Tejaswini Reddy flower bracket? press shift and anf then press that key on the keyboard
@minicraftyclub4258
@minicraftyclub4258 3 жыл бұрын
If variable name is “Dan” than we will use char ??
@LearningLad
@LearningLad 3 жыл бұрын
It's not about the variable name It's about the type of data we are storing
@gandamalamounika8476
@gandamalamounika8476 9 жыл бұрын
hello anil as u said that integers are numbers ryt then whats the diffence between age and weight as both are pepresented in numbers how come weight is floating point????
@saiphanindra4711
@saiphanindra4711 9 жыл бұрын
***** weight can be in decimals like 10.5, 50.7...but age is only numbers like 21, 34...so floating is for weight and int is for age..:)
@VashishtArora
@VashishtArora 10 жыл бұрын
Anil, please answer yogananda's question. Having the same doubt
@LearningLad
@LearningLad 10 жыл бұрын
blondekane hi i think i have answered his question. if not pls let me know what doubt u have.
@silver_ingame281
@silver_ingame281 10 жыл бұрын
Awesome video, would like to ask you a question, why is there a need to use %d,c and f? Wht is the purpose of this? Thanks
@silver_ingame281
@silver_ingame281 10 жыл бұрын
I tried to use %i for the age as it is an integer and it works too. Why do we need to use % in order to print out.
@LearningLad
@LearningLad 10 жыл бұрын
hi Silver_InGame %d, %f, %c etc are called format specifiers. They are like placeholders for some values and they start with the % symbol. consider printf("age is 25"); it will display only the age is 25 to the screen all the time. but if we use printf("age is %d",age); In this case %d acts like a placeholder for an integer value. Here "age is %d" acts as a template and we can use it to display different values stored in the age variable. So by using these format specifiers, we can create a template that can be used for different set of values. % is the least used symbol so thats why they used it to specify format specifiers i guess!
@kumariashutosh9142
@kumariashutosh9142 9 жыл бұрын
good evening sir, i am very weak in coding but i want to learn .and i am doing B.tech from computer science branch so it is very important for me to have proper knowledge and concept of c.so please suggest me some ideas so that i can improve my self and can do better from the other students in my class.
@saikiran-cb7jd
@saikiran-cb7jd 8 жыл бұрын
why are we using , int main() and printing "hello world" main doubt what is returning the value.
@FitnessChaos
@FitnessChaos 5 жыл бұрын
good video
@LearningLad
@LearningLad 5 жыл бұрын
Thank you :)
@uraaxeecaqligaaga4890
@uraaxeecaqligaaga4890 5 жыл бұрын
Thank you sir but please explain why you have not written scanf( ).
@CG-yw3eq
@CG-yw3eq 3 жыл бұрын
What editor are you using in the tutorial?
@LearningLad
@LearningLad 3 жыл бұрын
dev cpp
@ajaykalapad1541
@ajaykalapad1541 7 жыл бұрын
Sir, in row number15 why there is written about weight and sec but not about age?
@chinmaymhatre277
@chinmaymhatre277 8 жыл бұрын
Can we use %i insted of %d ?
@ankithprabhu4552
@ankithprabhu4552 9 жыл бұрын
anil bhaiya, this time i tried combining ur present n previous videos...but i get the output in a single line...how can i print 2 things in seperate lines waiting fr the answer u rock B)
@ankithprabhu4552
@ankithprabhu4552 9 жыл бұрын
i saw ur next video....sry....learning this fr the first time #prettyexcited
@p.naveenkumar1566
@p.naveenkumar1566 7 жыл бұрын
why we are using return 0 i cant understand will u please explain me...
@LearningLad
@LearningLad 7 жыл бұрын
to explain in simpler terms, when you run your program, operating system calls your program for execution, it starts with the main function of your program. main function is the starting point of the program. when we have int main it means that the main function while finishing the execution will return an integer value. this value will indicate whether program has successfully finished or encountered some error. return value of 0 means program has finished without any error. any other value will indicate a specific error. So we are using return 0; to indicate the operating system that our program has finished execution successfully.
@jainam_zobaliya
@jainam_zobaliya 6 жыл бұрын
@@LearningLad Instead of returning 0 I have tried different no.s but Instead of that no. It's returning a random no. Why this is happening?
@vedikagarg9127
@vedikagarg9127 9 жыл бұрын
which compiler should i use ?
@LearningLad
@LearningLad 9 жыл бұрын
+Vedika Garg use the gcc compiler. You can download and install the codeblocks ide with the mingw (Minimalist GNU for Windows). checkout kzbin.info/www/bejne/g3Wtaqh7fambnLc (this tutorial is in the c++ playlist. But you can use this for c also) Hope this helps ;)
@eggsybee9010
@eggsybee9010 8 жыл бұрын
sir... what is return 0;? and when do we use that?
@rameshkumarallam8476
@rameshkumarallam8476 8 жыл бұрын
hi sir its showing(error) expected `;' before "getch"
@mohammedibrahim9508
@mohammedibrahim9508 8 жыл бұрын
hi sir, my program is compiled but when i try to run it, its asking me "source file not compiled" can you help me out?
@LearningLad
@LearningLad 8 жыл бұрын
Thats because the dev cpp (from bloodshed) u have installed has some issues in windows 8 or later versions. First uninstall it and then download and install orwell dev cpp. it will work properly.
@mohammedibrahim9508
@mohammedibrahim9508 8 жыл бұрын
thank you so much i really appreciate it.
@dencygomes9750
@dencygomes9750 8 жыл бұрын
good morning sir..i tried this program and it got compiled correctly..but i have 1 doubt..i added char name and then after declaring i wrote it as name = 'Dency' and gender also i wrote it as gender= 'Male' but den in my output i got only one alphabet from my name ie. y (from the name)and e(from the gender) i want full name sir..how to print it?
@paulolando6782
@paulolando6782 6 жыл бұрын
hello sr Can you please clearly specify what type of software are you using to conde C languange
@sgt.boris4713
@sgt.boris4713 4 жыл бұрын
Dev C
@kumarmihiir7638
@kumarmihiir7638 9 жыл бұрын
source file is not getting compiled a dialogue for g++ exe no t responding pops out and .. while running it says the file hasn't been compiled
@LearningLad
@LearningLad 9 жыл бұрын
+Kumar Mihiir The problem is with the dev cpp ide. i Suggest you to use orwell dev cpp. Just google it and you will get the download link. or use codeblocks ide with mingw. checkout kzbin.info/www/bejne/g3Wtaqh7fambnLc hope this helps :)
@vickypandey5268
@vickypandey5268 7 жыл бұрын
hello i am getting an error when i tried to declare "school" as like char school it prompt as character constant must be one or two characters long what should i do
@LearningLad
@LearningLad 7 жыл бұрын
just give your sample code pls
@devarapallisrilakshmi8445
@devarapallisrilakshmi8445 4 жыл бұрын
Yes char is for single characters only declare it by using strings
@sharathkumar6651
@sharathkumar6651 10 жыл бұрын
i am getting the error as "SOURCE FILE NOT COMPILED" after compilation and running the program.PLZZZ GIVE ME REPLAY....
@LearningLad
@LearningLad 10 жыл бұрын
sharath kumar i think you are using windows 8 os and dev c++ compiler set. in windows 8 dev c++ has some issues so i suggest you to download and install codeblocks ide along with mingw compiler set. checkout this tutorial which explains how to download and install codeblocks. kzbin.info/www/bejne/g3Wtaqh7fambnLc Hope this helps :)
@kumarraja5761
@kumarraja5761 9 жыл бұрын
hello sir your teaching is good
@LearningLad
@LearningLad 9 жыл бұрын
kumar raja thanks man :)
@bhanukat7
@bhanukat7 10 жыл бұрын
Hello man thanks for the video tutorials. but i didn't getting the output menu in dev C++ can you help me for that..????
@LearningLad
@LearningLad 10 жыл бұрын
Hi Bhanu Prakash , if you are using windows 8 OS then Dev C++ won't work. Developers are not updating Dev C++ from a long time. So you can use Other IDE's like CodeBlocks, Eclipse etc. I have already made a tutorial on how to download and install CodeBlocks. Search for it in my channel. Thank you :)
@hirendarji9491
@hirendarji9491 10 жыл бұрын
guys those who are getting the "SOURCE FILE NOT COMPILED" in DEv C++ please download this overall version of dev C++ from here sourceforge.net/projects/orwelldevcpp/files/latest/download?source=files ..then you will be able to run your file surely.
@sreelakshmirsyam763
@sreelakshmirsyam763 9 жыл бұрын
sir, i have followed all your instructions but when i tried to compile, a message appeared telling that" printf undeclared (first use this function)" what should i do??
@LearningLad
@LearningLad 9 жыл бұрын
Sreelakshmi R Syam may be you have done some typo. check for that. if still the problem persists, then post the source code here so that i can help :)
@sreelakshmirsyam763
@sreelakshmirsyam763 9 жыл бұрын
*****thank u for ur reply :) .. checked for typos but couldnt find any.can i send what i have done as screenshot to your facebook page??(dont know how to post the source code here)
@LearningLad
@LearningLad 9 жыл бұрын
Sreelakshmi R Syam ok :)
@tejkiranyabaku435
@tejkiranyabaku435 7 жыл бұрын
when i change my data input to get different output i cant build and run the program as the option is blocked .how to solve this please help me
@LearningLad
@LearningLad 7 жыл бұрын
i think you are not closing the previous build (that cmd window) close it and you will get the options to run the program
@tejkiranyabaku435
@tejkiranyabaku435 7 жыл бұрын
thank you ...!!! now i got it
@smilygupta4879
@smilygupta4879 9 жыл бұрын
sir why u r use int main And we can't use void main here
@anjalisinha7801
@anjalisinha7801 7 жыл бұрын
hello sir i am not able to run the program.after compilation a warning occurs as "source file not compiled".please help me
@LearningLad
@LearningLad 7 жыл бұрын
that's because you are using bloodshed dev cpp in windows 8 or later version of os. this software is not be maintained now. uninstall it. download and install orwell dev cpp (simple google search will give you the download link) it will work :)
@indhujag5920
@indhujag5920 4 жыл бұрын
@@LearningLad bro it is not working even for codeblocks.What can I do? Please help
@powertran6755
@powertran6755 8 жыл бұрын
LearningLad can you fix this please When trying to compile we get a message: Warning! source file not compiled!!! thx
@AntarikshPratham
@AntarikshPratham 8 жыл бұрын
+powertran are you using an ide for coding? you have to systematically first build and then compile the program...
@divyapandu6277
@divyapandu6277 9 жыл бұрын
i installed software as u instructed but i am getting an error in run i am getting source file in not executed
@LearningLad
@LearningLad 9 жыл бұрын
Divya pandu hi, i think you are using windows 8 or later version of os, where dev cpp has some issues. So i suggest using codeblocks ide. (i have put an annotation about this in the video. i guess you have disabled annotations) checkout kzbin.info/www/bejne/g3Wtaqh7fambnLc Hope this helps :)
@MrRishabh04
@MrRishabh04 8 жыл бұрын
thnx bro
@LearningLad
@LearningLad 8 жыл бұрын
welcome :)
@boldowl6926
@boldowl6926 5 жыл бұрын
Please reply fast #include #include int main() { int age; float weight; char name; age = 17; weight = 55.8; name = 'Anish'; printf("%d %f %c",age,weight,name); getch(); return 0; } here i want to print name as anish but it says character constant too long for its type , what should i do if i want to print words instead of a single letter.
@LearningLad
@LearningLad 5 жыл бұрын
name is of type char so it can contain only one character. Anish is a string which contains more than one character. So you are getting the error. name = 'A' will work or you
@Christine-ne3dw
@Christine-ne3dw 5 жыл бұрын
You should use " " since it's a group of char then use %s to display it
@Christine-ne3dw
@Christine-ne3dw 5 жыл бұрын
. . . name = "anish"; printf("%s", name); . . .
@shreyashrivastava9208
@shreyashrivastava9208 9 жыл бұрын
hello sir,my program gets compiled easily but when i run it, it show "Source file not compiled" What should i do?
@LearningLad
@LearningLad 9 жыл бұрын
+Shreya Shrivastava download and install orwell dev cpp or codeblocks ide along with mingw compiler set.
@navaneethkrishna3885
@navaneethkrishna3885 7 жыл бұрын
sir do this work in turbo c++
@LearningLad
@LearningLad 7 жыл бұрын
yes. it will work
@tapasvipannaty2849
@tapasvipannaty2849 9 жыл бұрын
hello sir this is my program #include #include int main() { int age; float weight; char sex; age= 32; weight= 52.5; sex= 'f'; printf("%d %f %c" ,age,weight,sex); getch (); return 0; } i am using code blocks. when i tap on build operation.It is unable to build, it is showing some message here it is Message Build: debug in main error : Aborted (program collect 2) build failed please help me sir.
@tapasvipannaty2849
@tapasvipannaty2849 9 жыл бұрын
+Tapasvi Sri and program has compiled successfully.
@lissettevelec5955
@lissettevelec5955 5 жыл бұрын
How declare char variables fritsch and temp ch; ?
@avneeshmanian2387
@avneeshmanian2387 9 жыл бұрын
when i compile and run my file .... it says source file not compiled... what should i do?
@LearningLad
@LearningLad 9 жыл бұрын
+Avneesh Manian i think you are using windows 8 or later version of os and dev cpp has issues. ( i have informed about this in the video using annotation and also in description. You may have missed it) So i say you download and install codeblocks ide along with mingw compiler set. i have a video explains about it checkout kzbin.info/www/bejne/g3Wtaqh7fambnLc hope this helps :)
@percycebo50
@percycebo50 9 жыл бұрын
It says this when I try to compile it 17 5 C:\Users\user\Documents\4.c [Error] expected ';' before 'getch'
@LearningLad
@LearningLad 9 жыл бұрын
+Percy Cebo you missed a semicolon just before (previous line) the getch(); statement
@amitha.h.5804
@amitha.h.5804 7 жыл бұрын
hi i am getting run time error and if it works the output is not correct plzzz help me
@MANOJKUMAR-rw9zw
@MANOJKUMAR-rw9zw 7 жыл бұрын
i installed dev cpp.. and i have written a program. program got copiled but its not running
@anwaralam3136
@anwaralam3136 6 жыл бұрын
in this video all the output are printed in a same line what should i do if i want print the 3 output line by line 1)output 2)output 3)output like this....?
@chittireddy4244
@chittireddy4244 4 жыл бұрын
Use "/n:
@superb6993
@superb6993 9 жыл бұрын
Thank u sir,for ur video .This helped me a lot.But every time i compile the program i get indication from my antivirus that VIRUS detected .??????????????
@aadityaaumale0206
@aadityaaumale0206 8 жыл бұрын
Why you didn't use clrscr() after variable declaration..??
@kartick1241
@kartick1241 8 жыл бұрын
Modern c/c++ ide open a new output window everytime we run the program so there is no previous output showing so we can avoid using clrscr() [now system("cls"); ] until required.
@leochoi3181
@leochoi3181 5 жыл бұрын
not sure if im doing this right but i get this message Checking for existence: C:\Users\82108\Desktop\program\trial1.exe what does it mean??
@kirantomar1072
@kirantomar1072 7 жыл бұрын
sir age weight sex sare new line mai kese print hore h new line k liye to lgana hota h na
@suryarotte8479
@suryarotte8479 9 жыл бұрын
when i compile this program, I get output as 0, 0.000, 0 please help what does that mean?
@LearningLad
@LearningLad 9 жыл бұрын
+Surya Rotte may be you are not initializing the variables. pls post the source code here or send a screen shot on our facebook page.
@suryarotte8479
@suryarotte8479 9 жыл бұрын
+LearningLad okay sir
@suryarotte8479
@suryarotte8479 9 жыл бұрын
+Surya Rotte #include #include int main() { // datatype name; int age; float weight; float height; char sex; age = 23; weight = 50.2; height = 6.2; sex = 'M'; printf("%age %f %f %c age,weight,height,sex"); getch(); return 0;
@LearningLad
@LearningLad 9 жыл бұрын
Surya Rotte you got the printf function wrong. it should be printf("%d %f %f %c",age,weight,height,sex); hope this helps :)
@shilamandal6837
@shilamandal6837 7 жыл бұрын
my program is not compile pls tell me.. how to save my program and run
@LearningLad
@LearningLad 7 жыл бұрын
what error you are getting??? also checkout the comment section of this video. you may get the solution for your problem :)
@zybotsu001
@zybotsu001 8 жыл бұрын
why a capital 'M' for char, shouldn't it be 'm'? Wouldn't that report an error?
@sunilpatil8144
@sunilpatil8144 8 жыл бұрын
NO...you have declaired variable "sex" which is of "character" type and in "sex" variable you have stored capital "M"...It won't give any error :)
@sunilpatil8144
@sunilpatil8144 8 жыл бұрын
You can store anything in "sex" variable as long as it it of "character" type :)
@UnknownPerson-eu3vm
@UnknownPerson-eu3vm 8 жыл бұрын
what's difference between %d and %i ?
@TheNiccopark
@TheNiccopark 9 жыл бұрын
hey ...great video but why have you used "%d %f %s" ........what do they mean???
@LearningLad
@LearningLad 9 жыл бұрын
andrew %d %f %s are called as format specifiers. we use %d for integers %f for float %s for strings etc.
@TheNiccopark
@TheNiccopark 9 жыл бұрын
thanks
@sandeshsubedi2922
@sandeshsubedi2922 9 жыл бұрын
Why is %d used for age ?
@LearningLad
@LearningLad 9 жыл бұрын
+Sandesh Subedi age is of type int. so we use %d format specifier.
@amitghosh3938
@amitghosh3938 6 жыл бұрын
Hey, this is not working in turbo c
@thanoszaxarias9714
@thanoszaxarias9714 9 жыл бұрын
printf("%d %f %c",age,weight,sex); it finds fault on it and it doesnt run why?
@LearningLad
@LearningLad 9 жыл бұрын
+Thanos Zaxarias send the complete source code pls...
@thanoszaxarias9714
@thanoszaxarias9714 9 жыл бұрын
i wrote it again and i was missing a (;) and dint close the main }.I am sorry -.-
@thanoszaxarias9714
@thanoszaxarias9714 9 жыл бұрын
i want to ask something new sir, can u please explain me the usage of #include.I use it but i dont know why i use it thanks ;D
@johnyvicewax7375
@johnyvicewax7375 10 жыл бұрын
Hello Sir, In assigning sex; gender, how to assign sex=MALE instead of 'M'?
@LearningLad
@LearningLad 10 жыл бұрын
Yogananda Kh you have to use a character array to store string values. which i have explained in a specific tutorial. checkout kzbin.info/www/bejne/aKi9enifn5aYes0 Hope this helps :)
@johnyvicewax7375
@johnyvicewax7375 10 жыл бұрын
***** thank you sir, i will learn in order of your lessons.
@pallerlanandakishore7251
@pallerlanandakishore7251 8 жыл бұрын
In char i entered my name and it is showing a warning that character constant is too long. why?
@ummulhuda1278
@ummulhuda1278 8 жыл бұрын
A character can be only single digit
@shravyareddy4194
@shravyareddy4194 8 жыл бұрын
hi sir, im getting y at sex as output im not getting f 'f';
@adhishaggarwal5232
@adhishaggarwal5232 8 жыл бұрын
hi sir, its showing [Error] expected ',' before 'sex'
@LearningLad
@LearningLad 8 жыл бұрын
pls provide source code. you might have missed a semicolon.
@_kale_4337
@_kale_4337 7 жыл бұрын
#include #include int main() { //datatype name; int age; float weight; char sex; age = 23; weight = 50.5; sex = 'M'; printf("%d %f %c",age,weight,sex); getch(); return 0; } but still the output is not the same. only " #d #f #c ". what to do.
@rameshdevasi217
@rameshdevasi217 6 жыл бұрын
please help me: tell me why %d is for data??????????????? :(
@mohammedanwarfaizi2850
@mohammedanwarfaizi2850 8 жыл бұрын
WHY ARE USING int main () WHERE main() IS ENOUGH? CAN YOU PLEASE ANSWER?
@saikiran-cb7jd
@saikiran-cb7jd 8 жыл бұрын
yup! mr.mohammed anwar point to be noted is that, main() is the function type ,,, and int is the data typewith out mentioning the data, type for main function, then how does the computer understand, to take the valueslike---int values, char values, flote values
@saikiran-cb7jd
@saikiran-cb7jd 8 жыл бұрын
hope! you understant
@Icyhandss
@Icyhandss Жыл бұрын
Hello! I know this video tutorial is 10 years ago, I am a freshman student taking BS Computer Science, I want to ask whats wrong with my code, I am trying to output a name and date of birth using printf input name and scanf char name; printf("insert name: "); scanf("%c", &name); int birthday; printf("input date: "); scanf("%d", &birthday); printf("My name is %c and my birthday is %d", name, birthday); I hope you notice thank you so much
@LearningLad
@LearningLad Жыл бұрын
char data type can hold only one character. you cant enter your name for that
@Icyhandss
@Icyhandss Жыл бұрын
@@LearningLad Hi! Its me again, I hope you’ll notice me again, I am struggling to grasp the C language but cant afford to fail. If its not too much, Whats wrong with my code? int age; printf("Enter Age "); scanf("%d", &age); char sex; printf("Enter M or F "); scanf("%c", &sex); if (age > 17 ) { switch (sex) { case 'm': printf("adult male"); break; case 'f': printf("Adult Female"); break; } } else if (age < 18) { switch (sex) { case 'm': printf("Male Minor"); break; case 'f': printf("Female Minor"); break; } } I am receiving dash: 2 m: not found I tried other online compiler the result is Program finished with exit code 0 Thank you for your help. 🥹🥹🥹
@prathameshchavan2812
@prathameshchavan2812 9 жыл бұрын
Why a character is written in a single quote?
@sunderaatma9379
@sunderaatma9379 8 жыл бұрын
i ve saved and compiled this program of age,weight,sex but when i run it,it is not showing the data. It is showing 0 0.000000 a ,age,weight,sex. PLZ TELL THE SOLUTION?
@LearningLad
@LearningLad 8 жыл бұрын
pls send a message to our facebook page along with your source code.
@rajanagenderreddy3929
@rajanagenderreddy3929 7 жыл бұрын
#include #include int main() { int age; float weight; char sex; age = 25; weight = 90.5; sex = "M"; printf("%d %f %c",age,weight,sex); getch(); return 0; } but in output "M" charecter is not coming
@anujasonavane
@anujasonavane 7 жыл бұрын
#include #include int main() { //data type name; int age; float weight; char sex; age = 17; weight = 40; sex = 'F'; printf("%d %f %c",age,weight,sex) getch(); return 0; } 16 D:\Desktop\c++\second.c syntax error before "getch" what should i do? whats wrong with it?
@nisarpasha5328
@nisarpasha5328 7 жыл бұрын
printf("%d %f %c",age,weight,sex);
@tdganimations6209
@tdganimations6209 3 жыл бұрын
printf("age= %d weight= %f gender= %c height= %f ", age, weight, sex, height);
@tdganimations6209
@tdganimations6209 3 жыл бұрын
this also works guys
@cedrickfitness
@cedrickfitness 10 жыл бұрын
Hello Learning Lad, I cant run my code :(
@hemanthchinnu5576
@hemanthchinnu5576 7 жыл бұрын
Hi Anil when I am executing the same program it is showing some error in the place float could you please help me... #include #include int main() { float weight; float = 51.5; printf("%f",float); getch(); return 0; } it is showing some error like "syntax error before float"
@LearningLad
@LearningLad 7 жыл бұрын
float is the datatype. you need to assign value to the variable weight. so replace float = 51.5; with weight = 51.5;
@ankithprabhu4552
@ankithprabhu4552 9 жыл бұрын
hi anil bhaiya can u pls tell me how can i make it print the results as age 23 weight 50.500000 sex M ????? pls reply soon great job B)
@ankithprabhu4552
@ankithprabhu4552 9 жыл бұрын
got it..hehe
@kardsrohitjagtap2285
@kardsrohitjagtap2285 8 жыл бұрын
hey..if i want to show sex = m than how shall be program
@arctic_corner
@arctic_corner 9 жыл бұрын
can i write char sex; sex = 'Male'; ?
@LearningLad
@LearningLad 9 жыл бұрын
Sophia Man no you can't. Because here in your example, sex is a character variable so you can store only one character in it. When we have more than one character, we need to use a character array which you will learn later in this series :)
@arctic_corner
@arctic_corner 9 жыл бұрын
thanks ! you answer every question that's very nice of you !
@gergelyfekete5917
@gergelyfekete5917 8 жыл бұрын
who know create snowflake in language c?
@davidb8831
@davidb8831 9 жыл бұрын
A few things I didn't understand because you spoke too fast.. you should make a group on google hangouts!
@thanoszaxarias9714
@thanoszaxarias9714 9 жыл бұрын
+David B thats why there is the pause button on youtube
@somnathbhattacharya1698
@somnathbhattacharya1698 7 жыл бұрын
sir cant see clearly....make page clear
@DeyvesshKumar
@DeyvesshKumar 9 жыл бұрын
#include #include int main() { int age; float weight; char sex; printf("Enter your age, weight, sex "); scanf("%d%f%s",&age,&weight,&sex); printf("Your age is %d Your weight is %f Your sex is %s",age,weight,sex); getch(); return 0; } IS MY PROGRAM CORRECT? BECAUSE THE RUN COMMAND DOES NOT LETTING ME TO ENTER THE VALUE OF CHARACTER 'SEX'.
@LearningLad
@LearningLad 9 жыл бұрын
Deyvessh Kumar since sex is a character variable, use %c format specifier. But after changing that also you will not be able to read value for sex. That's because after entering value for weight, you hit enter button or a space to separate input and that input separation will be read for sex. So it won't give you an option to enter value for sex or will not read proper value for sex. So here is a quick fix which will let you run your program. Use a space after reading weight. i.e scanf("%d%f %c",&age,&weight,&sex); This space we added will be matched for the enter or the space you add after entering weight, and then you can read the value for sex. here is the working code. #include #include int main() { int age; float weight; char sex; printf("Enter your age, weight, sex "); scanf("%d%f %c",&age,&weight,&sex); printf("Your age is %d Your weight is %f Your sex is %c ",age,weight,sex); getch(); return 0; } Hope this helps :)
@aadarshasubedi123
@aadarshasubedi123 9 жыл бұрын
hello devessh Kumar if you write %c then output should be "m" or "f" but if you write "male" or "female" then there should be %s. since "%c" is for one character whereas "%s" is for string.
@aadarshasubedi123
@aadarshasubedi123 9 жыл бұрын
+aadarsha subedi you should verify male or female in main function. .
@avneeshmanian2387
@avneeshmanian2387 9 жыл бұрын
i am having difficulty compiling it
@JonathanDean95
@JonathanDean95 9 жыл бұрын
+Avneesh Manian which compiler are you using ?
@vikikaushik9318
@vikikaushik9318 9 жыл бұрын
vickeyvk93
@ರಾಮಾಚಾರಿ-ಸ5ವ
@ರಾಮಾಚಾರಿ-ಸ5ವ 6 жыл бұрын
Ur age is not 23
@smilygupta4879
@smilygupta4879 9 жыл бұрын
sir why u r use int main And we can't use void main here
Printf Function in C Programming Language Video Tutorial
5:10
LearningLad
Рет қаралды 304 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Introduction to C Programming Language and Why Study it ?
5:29
Learning C Programming Language compared to English
3:31
LearningLad
Рет қаралды 3