Constants in C (Part 1)

  Рет қаралды 255,723

Neso Academy

Neso Academy

Күн бұрын

Пікірлер: 96
@AmitSingh-ku3ug
@AmitSingh-ku3ug 3 жыл бұрын
Truly speaking... You won't find anything better than this.. 👍
@sidakrvps
@sidakrvps 5 жыл бұрын
Great teaching method by Neso academy for real learners. Please note preprocessing is done before compiling the code, therefore to get the current time and date by use of __TIME__ and__DATE__ we need to build and run the code each time instead of just running it. Please correct if I am wrong.
@JossinJax
@JossinJax 3 жыл бұрын
Wow, had no idea you could define functions like that.
@skandeshkkblr3416
@skandeshkkblr3416 Жыл бұрын
The best content one can ever find for c programming... Thanks a ton for the priceless content!
@tayyab.sheikh
@tayyab.sheikh 7 ай бұрын
I regret I missed your videos 😢 ❤ from 🇵🇰
@susanjacob937
@susanjacob937 3 жыл бұрын
For those getting an error for if and else program try this : #include # define max(x,y) if(x>y) \ printf("%d is greater than %d", x,y);\ else\ printf("%d is less than %d",x,y) int main(){ max(5,6); return 0; }
@DurgaPrasad-jr1yl
@DurgaPrasad-jr1yl 3 жыл бұрын
u have used max two times with same letters plzz use capital at any of that one then it will get
@jabasjabas1434
@jabasjabas1434 2 жыл бұрын
Bro at the final of the else statement / is missing and semi colan is also missing
@ignitedminds6164
@ignitedminds6164 Жыл бұрын
I saw a lot of videos about c language .But this channel deserves that place
@deboshreedey2333
@deboshreedey2333 6 жыл бұрын
Your lectures are really very helpful ...thank you for your efforts
@Mr.nikk62
@Mr.nikk62 3 жыл бұрын
your explanation way is so clear, good,understandable
@erichacop3005
@erichacop3005 3 жыл бұрын
Brilliantly organized!! Thank you to you!
@victor_zsasz
@victor_zsasz 2 жыл бұрын
information overload..idk why we pay so much to colleges.Thankyou sir!!!!!!
@ABDULRAZZAQ-yk7gf
@ABDULRAZZAQ-yk7gf 3 жыл бұрын
sir, I don't know English, but I understand it easily.
@srikarrepaka5023
@srikarrepaka5023 3 жыл бұрын
0:12 0:21 2:16 3:01 4:25 5:03 5:36 6:30 8:02 8:23
@akkasanisreelatha3282
@akkasanisreelatha3282 2 ай бұрын
Best explanation
@opst1704
@opst1704 4 жыл бұрын
Tips 1. Don't add semicolon at the end ; ❌ 2. USE CAPITAL LETTERS 3. We can use functions 4. There are predefined macros like ___TIME___ and ___DATE___ edit: had to add one more _ because KZbin makes text cursive if you use two __ at the beginning and at the end of a word
@pradhanan9413
@pradhanan9413 3 жыл бұрын
You can add multiple lines by /
@rakeshraj4786
@rakeshraj4786 6 жыл бұрын
the best lecture on youtube......
@brajanxholaj9767
@brajanxholaj9767 3 жыл бұрын
thanks legend
@compangit1524
@compangit1524 Жыл бұрын
Comment to myself: Review preprocessors. Define constants thru #define or const keyword. Like so, #define NAME value. NAME is also called Macro. We can use Macros like functions. We can use \ for multiple lines. With macros used as functions they expand explicitly, meaning they are injected in the code and then implemented. Macros like functions don't evaluate within itself. There are default macros like __DATE__ and __TIME__
@apnagallery8870
@apnagallery8870 3 жыл бұрын
Best explanation 💥
@-MustakimMusa
@-MustakimMusa 6 ай бұрын
#include #define ADD(x,y) x+y int main() { int var=3; printf("addition of two numbers %d ", ADD(3,4)); return 0; }
@cm-106murali3
@cm-106murali3 2 жыл бұрын
Last lo time date progarm printf lo ℅s anduku icharu time date lo integers kuda vunai kadha
@014-neerajajadhav3
@014-neerajajadhav3 2 жыл бұрын
Sir in the first example %5f means after decimal 5 digits will be given as out puts
@gkushwanth2277
@gkushwanth2277 2 жыл бұрын
excellent information about macros
@thureinlinn1789
@thureinlinn1789 2 жыл бұрын
Your explanations are clear and understandable for a beginner like me . May I know the background music at the end of the video,Sir?
@TechAndFunWithAkash
@TechAndFunWithAkash 5 жыл бұрын
there is an error in #define greater(x,y) if(x>y) \ printf();\else\printf();......................it would be like..#define greater(x.y) if(x>y) printf();\else\printf();
@sandeshadhikari2889
@sandeshadhikari2889 4 жыл бұрын
@Nadeem Afzal did t work again
@khatariinsaan5284
@khatariinsaan5284 3 жыл бұрын
@@sandeshadhikari2889 YES I have also tried
@cherryson4625
@cherryson4625 3 жыл бұрын
Play games..Nahhhh Watch NESO academy lectures... Yayyyyyy
@clashbegins2063
@clashbegins2063 2 жыл бұрын
How it is solved? # define add(s,y) s+y/ s-y int main(){ printf("%d",5*add(3,7));
@madhavikatta7346
@madhavikatta7346 5 жыл бұрын
Sir pls upload array, pointers
@Abdulrahman-uk9ny
@Abdulrahman-uk9ny 5 жыл бұрын
+1
@vonucabage1483
@vonucabage1483 4 жыл бұрын
superb! thankyou
@LogoSystemCG
@LogoSystemCG Жыл бұрын
to write mulitple lines, it's not slash but back slash actually. (not the same ^-^)
@abdullahalmamun8476
@abdullahalmamun8476 4 жыл бұрын
Super 👌👌
@anaghapc8872
@anaghapc8872 5 жыл бұрын
Sir while using \ output becomes error .Here in main() printf is not used.
@bhoomikashetty3969
@bhoomikashetty3969 3 жыл бұрын
Just awesome teaching 👍👍👍
@sudipsarkar1400
@sudipsarkar1400 3 жыл бұрын
Awesome video sir
@amrnassar3618
@amrnassar3618 4 жыл бұрын
thanks
@kostavsheoran1530
@kostavsheoran1530 5 жыл бұрын
I have a doubt , when you wrote #define add(x, y) x+y , the pre processor is going to replace x+y wherever add(x, y) is written , but when yo wrote add(5, 6) , why did it replaced it to 5+6 , how did it know x,y were variables?
@ArjanvanVught
@ArjanvanVught 4 жыл бұрын
x and y are not variables. They are substitution names. Moreover, it should be #define add(x, y) (x+y)
@hariharasudhans7828
@hariharasudhans7828 Жыл бұрын
Mass bro
@Godl_Damon
@Godl_Damon 3 жыл бұрын
Sir what about prefixes and suffixes
@RATANAGARWALITINFORMER
@RATANAGARWALITINFORMER 2 жыл бұрын
thx
@vamsikrishna2316
@vamsikrishna2316 4 жыл бұрын
can we return values from macro functions...?
@md.arifulislam2339
@md.arifulislam2339 3 жыл бұрын
What is actually our university doing? They should suggest neso academy and sleep.
@reezyyy8800
@reezyyy8800 4 жыл бұрын
1:59 does anybody know why it says printf("%.5f", PI) instead of just saying printf("%f", PI)? I mean what's the difference??
@dhruvrajkotiya
@dhruvrajkotiya 4 жыл бұрын
%.5f means it will round off value or you can say that it consider a value up to 5 decimal places after the point for example value of pi = 3.14159265358979323846 if we print using printf("%.5f",pi); then out put will be 3.14159
@reezyyy8800
@reezyyy8800 4 жыл бұрын
@@dhruvrajkotiya alright, thank you very much!
@NNELATURIASHOKKUMAR
@NNELATURIASHOKKUMAR 4 жыл бұрын
it means that pi value should be printed 5 decimal values after decimal point
@aditisharma5192
@aditisharma5192 3 жыл бұрын
Why he use f instead d like before section he use everywhere %d why here he use f instead of that please answer
@ritikshrivastava6426
@ritikshrivastava6426 3 жыл бұрын
@@aditisharma5192 %d is a placeholder for variables having integer values, %f is a placeholder for variables having float/decimal values, similarly %s is for strings etc etc check out the prev videos in this playlist for the whole list of placeholders
@Manster-minds
@Manster-minds 3 жыл бұрын
Gold
@true4189
@true4189 4 жыл бұрын
Thank u
@nimisharawat9949
@nimisharawat9949 3 жыл бұрын
Sir u r the bestttt
@NoName-vg8vf
@NoName-vg8vf 4 жыл бұрын
why PI is a float type variable??
@chaitanyanagasundarakc3163
@chaitanyanagasundarakc3163 4 жыл бұрын
why we need %s to print the current time and current date.what does %s indicates ?is it string specifier or other else
@manasgoel7351
@manasgoel7351 4 жыл бұрын
%s indicates that the value is a string of characters
@stardust8647
@stardust8647 3 жыл бұрын
@@manasgoel7351 so why we are not putting string headerfile?
@shathyanettem47
@shathyanettem47 2 жыл бұрын
Sir, can't we use that constant value in variables?
@sulekhaprasad6554
@sulekhaprasad6554 5 жыл бұрын
Why did u use "%s" in predefined macros while the result is decimal
@peddireddyvaishnavi7027
@peddireddyvaishnavi7027 5 жыл бұрын
That is %5f which means 5 numbers after point
@kristinasimonova2236
@kristinasimonova2236 Жыл бұрын
How Programm knows which data type is defined in macro? we don't mention data type in it: #define PI 3,14...
@tanaykamath1415
@tanaykamath1415 4 жыл бұрын
Sir when you printed the value of PI why did we get a white space after it,you didn't add any !??
@arkknight112
@arkknight112 3 жыл бұрын
is used for printing the statment in next line
@ritiksaxenaofficial
@ritiksaxenaofficial 5 жыл бұрын
dope explanation👌
@2kthilip602
@2kthilip602 Жыл бұрын
Why do we use %s at the last program where we use predefined macros
@rupaknath6900
@rupaknath6900 5 жыл бұрын
Nice
@luffydono0
@luffydono0 Жыл бұрын
date;- 15 july 2023 reached on constant
@jagadeeshkattiri1913
@jagadeeshkattiri1913 4 жыл бұрын
can we place two underscore at a time
@Godl_Damon
@Godl_Damon 3 жыл бұрын
Yeah
@jaswanthkaandagatlla4394
@jaswanthkaandagatlla4394 4 жыл бұрын
date and time was showing wrong
@gunjanlakhlani
@gunjanlakhlani 2 жыл бұрын
There is an error in his explanation regarding macro expansion. #define add(x, y) (x + y) is the macro that is defined and then he mentions that the result of printf("result of expression a*b + c is: %d", 5*add(4, 3)) is 23 (because it is 5*4 + 3). This is incorrect as the above macro expands to add(argument1, argument2) = argument1 + argument2 So in the printf statement it becomes 5*add(4, 3) = 5*(4 + 3) = 5*4 + 5*3 = 20 + 15 = 35. Which is consistent with the BODMAS rule. Please keep this in mind.
@anandpriyanshu9110
@anandpriyanshu9110 2 жыл бұрын
It's #define add(x,y) x+y Here add(x,y) is name of constant and x+y is its value so add(x,y) is replaced with just x+y not (x+y) So the substituted expression looks like- 5*4+3 so the answer is 23.
@codewithmadrine7843
@codewithmadrine7843 Жыл бұрын
8:19 my time output is not right , is there away like to modify timezones in c?
@yanoski9
@yanoski9 5 ай бұрын
the code at the end doesnot compile on Vs
@Iamthe_harsh
@Iamthe_harsh 11 ай бұрын
can I get notes for this?
@jeffbezos3942
@jeffbezos3942 3 жыл бұрын
How can I define a file?
@mr.rachetphilanthrophist601
@mr.rachetphilanthrophist601 4 жыл бұрын
#include #define ADD(x,y) x+y #define G(u,v) if(u>v)\ printf("%d is greater than %d ",u,v);\ else \ printf("%d is greater than %d ",v,u); #define E(m,n,p) m-n*p #define F(l,m,n) (l-m*n) int main() { printf("addition of two numbers: %d ",ADD(4,3)); G(4,5); G(5,6); printf("result of expression a*b-c*d is :%d and not :%d",5*E(2,3,6),5*F(2,3,6)); //expand expression as is defined by macro ... //...and follow order of precedence to evaluate expression return 0; }
@mr.rachetphilanthrophist601
@mr.rachetphilanthrophist601 4 жыл бұрын
i have combined last two three # concepts in single program.Check it's o/p by compiling & running it on IDE.Mark the difference between expression E and F both will give different output (why?).Can we Use same argument x and y for other macros instead of assigning other variables u,v,m,n,l,p etc.
@arvinthathikesav3531
@arvinthathikesav3531 2 жыл бұрын
Sir please provide notes
@technicalllinone6957
@technicalllinone6957 2 жыл бұрын
Hlo sir Multiple lines code is not working in #define it's showing error
@PRAKASH-hp6eg
@PRAKASH-hp6eg 3 жыл бұрын
Time and date are coming wrong for me🤔
@jabasjabas1434
@jabasjabas1434 2 жыл бұрын
Bro i tried in but the out put comes with null
@ashishwagh2586
@ashishwagh2586 3 жыл бұрын
Addition programm getting error
@dr.anubhavkumarprasad5765
@dr.anubhavkumarprasad5765 4 жыл бұрын
#define max(x) x*x please explain printf("%d", max(2+3));
@shubhampathak7926
@shubhampathak7926 4 жыл бұрын
error as you are not writing 'max' micro correctly in printf(" ").
@dr.anubhavkumarprasad5765
@dr.anubhavkumarprasad5765 4 жыл бұрын
@@shubhampathak7926 its correct. I figured out the answer. its 2+3*2+3 =11.
@phanindrasaikuriti6434
@phanindrasaikuriti6434 3 жыл бұрын
When we are getting subtitles , half of the code is can't see.
@ArvindKumar-ed4pl
@ArvindKumar-ed4pl 3 жыл бұрын
Greater program giving error Condition is always false
@retrotechnerd
@retrotechnerd Жыл бұрын
“Lesser than” is grammatically wrong. Use “less than”.
@yagneshacharya2461
@yagneshacharya2461 2 жыл бұрын
views = 167500 and likes = 2700 ,, therefore /// views - likes = 164537 hence 164537 people will go to hell if they doestn't like this video
Constants in C (Part 2)
4:05
Neso Academy
Рет қаралды 163 М.
Defining Constants. Should I use CONST or #DEFINE?
7:59
Jacob Sorber
Рет қаралды 56 М.
Underwater Challenge 😱
00:37
Topper Guild
Рет қаралды 47 МЛН
PEDRO PEDRO INSIDEOUT
00:10
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 26 МЛН
Blue Food VS Red Food Emoji Mukbang
00:33
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 34 МЛН
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 843 М.
the cleanest feature in C that you've probably never heard of
8:13
Low Level Learning
Рет қаралды 135 М.
Basic Input Function - scanf
5:08
Neso Academy
Рет қаралды 179 М.
C Programming (Important Questions Set 2)
6:10
Neso Academy
Рет қаралды 527 М.
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Рет қаралды 2,2 МЛН
C_08 Variables in C Programming | C Programming Tutorials
14:56
Jenny's Lectures CS IT
Рет қаралды 504 М.
A const int is not a constant.
9:16
Jacob Sorber
Рет қаралды 67 М.
Special Programs in C − Pyramid of Stars
11:06
Neso Academy
Рет қаралды 863 М.
Variable Modifiers − Auto & Extern
12:52
Neso Academy
Рет қаралды 333 М.
Underwater Challenge 😱
00:37
Topper Guild
Рет қаралды 47 МЛН