Constants in C (Part 1)

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 พ.ย. 2024

ความคิดเห็น • 96

  • @AmitSingh-ku3ug
    @AmitSingh-ku3ug 3 ปีที่แล้ว +70

    Truly speaking... You won't find anything better than this.. 👍

  • @sidakrvps
    @sidakrvps 5 ปีที่แล้ว +11

    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.

  • @skandeshkkblr3416
    @skandeshkkblr3416 ปีที่แล้ว +2

    The best content one can ever find for c programming... Thanks a ton for the priceless content!

  • @ignitedminds6164
    @ignitedminds6164 2 ปีที่แล้ว +1

    I saw a lot of videos about c language .But this channel deserves that place

  • @Mr.nikk62
    @Mr.nikk62 3 ปีที่แล้ว +2

    your explanation way is so clear, good,understandable

  • @JossinJax
    @JossinJax 3 ปีที่แล้ว +11

    Wow, had no idea you could define functions like that.

  • @deboshreedey2333
    @deboshreedey2333 6 ปีที่แล้ว +6

    Your lectures are really very helpful ...thank you for your efforts

  • @erichacop3005
    @erichacop3005 3 ปีที่แล้ว +2

    Brilliantly organized!! Thank you to you!

  • @rakeshraj4786
    @rakeshraj4786 6 ปีที่แล้ว +2

    the best lecture on youtube......

  • @tayyab.sheikh
    @tayyab.sheikh 9 หลายเดือนก่อน +2

    I regret I missed your videos 😢
    ❤ from 🇵🇰

  • @akkasanisreelatha3282
    @akkasanisreelatha3282 4 หลายเดือนก่อน

    Best explanation

  • @victor_zsasz
    @victor_zsasz 2 ปีที่แล้ว +1

    information overload..idk why we pay so much to colleges.Thankyou sir!!!!!!

  • @gkushwanth2277
    @gkushwanth2277 2 ปีที่แล้ว

    excellent information about macros

  • @-MustakimMusa
    @-MustakimMusa 8 หลายเดือนก่อน +1

    #include
    #define ADD(x,y) x+y
    int main() {
    int var=3;
    printf("addition of two numbers %d
    ", ADD(3,4));
    return 0;
    }

  • @ABDULRAZZAQ-yk7gf
    @ABDULRAZZAQ-yk7gf 3 ปีที่แล้ว +2

    sir, I don't know English, but I understand it easily.

  • @apnagallery8870
    @apnagallery8870 3 ปีที่แล้ว +1

    Best explanation 💥

  • @opst1704
    @opst1704 5 ปีที่แล้ว +8

    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 TH-cam makes text cursive if you use two __ at the beginning and at the end of a word

    • @pradhanan9413
      @pradhanan9413 3 ปีที่แล้ว +2

      You can add multiple lines by /

  • @sudipsarkar1400
    @sudipsarkar1400 3 ปีที่แล้ว

    Awesome video sir

  • @bhoomikashetty3969
    @bhoomikashetty3969 3 ปีที่แล้ว

    Just awesome teaching 👍👍👍

  • @susanjacob937
    @susanjacob937 3 ปีที่แล้ว +4

    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

  • @vonucabage1483
    @vonucabage1483 4 ปีที่แล้ว +1

    superb! thankyou

  • @cherryson4625
    @cherryson4625 4 ปีที่แล้ว

    Play games..Nahhhh
    Watch NESO academy lectures... Yayyyyyy

  • @brajanxholaj9767
    @brajanxholaj9767 3 ปีที่แล้ว +2

    thanks legend

  • @abdullahalmamun8476
    @abdullahalmamun8476 4 ปีที่แล้ว +1

    Super 👌👌

  • @hariharasudhans7828
    @hariharasudhans7828 2 ปีที่แล้ว

    Mass bro

  • @014-neerajajadhav3
    @014-neerajajadhav3 2 ปีที่แล้ว

    Sir in the first example %5f means after decimal 5 digits will be given as out puts

  • @madhavikatta7346
    @madhavikatta7346 6 ปีที่แล้ว +6

    Sir pls upload array, pointers

  • @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__

  • @amrnassar3618
    @amrnassar3618 4 ปีที่แล้ว

    thanks

  • @LogoSystemCG
    @LogoSystemCG ปีที่แล้ว

    to write mulitple lines, it's not slash but back slash actually. (not the same ^-^)

  • @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?

  • @Manster-minds
    @Manster-minds 3 ปีที่แล้ว

    Gold

  • @nimisharawat9949
    @nimisharawat9949 4 ปีที่แล้ว

    Sir u r the bestttt

  • @clashbegins2063
    @clashbegins2063 2 ปีที่แล้ว +1

    How it is solved?
    # define add(s,y) s+y/ s-y
    int main(){
    printf("%d",5*add(3,7));

  • @vamsikrishna2316
    @vamsikrishna2316 4 ปีที่แล้ว +2

    can we return values from macro functions...?

  • @md.arifulislam2339
    @md.arifulislam2339 3 ปีที่แล้ว +2

    What is actually our university doing? They should suggest neso academy and sleep.

  • @RATANAGARWALITINFORMER
    @RATANAGARWALITINFORMER 2 ปีที่แล้ว

    thx

  • @Godl_Damon
    @Godl_Damon 4 ปีที่แล้ว +1

    Sir what about prefixes and suffixes

  • @ritiksaxenaofficial
    @ritiksaxenaofficial 5 ปีที่แล้ว +1

    dope explanation👌

  • @true4189
    @true4189 4 ปีที่แล้ว

    Thank u

  • @cm-106murali3
    @cm-106murali3 3 ปีที่แล้ว +1

    Last lo time date progarm printf lo ℅s anduku icharu time date lo integers kuda vunai kadha

  • @shathyanettem47
    @shathyanettem47 3 ปีที่แล้ว +1

    Sir, can't we use that constant value in variables?

  • @luffydono0
    @luffydono0 ปีที่แล้ว

    date;- 15 july 2023 reached on constant

  • @rupaknath6900
    @rupaknath6900 5 ปีที่แล้ว

    Nice

  • @anaghapc8872
    @anaghapc8872 5 ปีที่แล้ว +3

    Sir while using \ output becomes error .Here in main() printf is not used.

  • @AkashIsLiv
    @AkashIsLiv 5 ปีที่แล้ว +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();

  • @Iamthe_harsh
    @Iamthe_harsh ปีที่แล้ว

    can I get notes for this?

  • @NoName-vg8vf
    @NoName-vg8vf 4 ปีที่แล้ว +1

    why PI is a float type variable??

  • @kostavsheoran1530
    @kostavsheoran1530 5 ปีที่แล้ว +3

    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 ปีที่แล้ว +4

      x and y are not variables. They are substitution names. Moreover, it should be #define add(x, y) (x+y)

  • @chaitanyanagasundarakc3163
    @chaitanyanagasundarakc3163 4 ปีที่แล้ว +1

    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 ปีที่แล้ว +2

      @@manasgoel7351 so why we are not putting string headerfile?

  • @jagadeeshkattiri1913
    @jagadeeshkattiri1913 4 ปีที่แล้ว +2

    can we place two underscore at a time

  • @sulekhaprasad6554
    @sulekhaprasad6554 5 ปีที่แล้ว +3

    Why did u use "%s" in predefined macros while the result is decimal

  • @arvinthathikesav3531
    @arvinthathikesav3531 3 ปีที่แล้ว

    Sir please provide notes

  • @2kthilip602
    @2kthilip602 ปีที่แล้ว

    Why do we use %s at the last program where we use predefined macros

  • @jaswanthkaandagatlla4394
    @jaswanthkaandagatlla4394 4 ปีที่แล้ว +2

    date and time was showing wrong

  • @kristinasimonova2236
    @kristinasimonova2236 ปีที่แล้ว

    How Programm knows which data type is defined in macro? we don't mention data type in it: #define PI 3,14...

  • @reezyyy8800
    @reezyyy8800 4 ปีที่แล้ว +5

    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 ปีที่แล้ว +21

      %.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 ปีที่แล้ว +4

      @@dhruvrajkotiya alright, thank you very much!

    • @NNELATURIASHOKKUMAR
      @NNELATURIASHOKKUMAR 4 ปีที่แล้ว +1

      it means that pi value should be printed 5 decimal values after decimal point

    • @aditisharma5192
      @aditisharma5192 4 ปีที่แล้ว

      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 4 ปีที่แล้ว +1

      @@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

  • @jeffbezos3942
    @jeffbezos3942 3 ปีที่แล้ว +1

    How can I define a file?

  • @tanaykamath1415
    @tanaykamath1415 4 ปีที่แล้ว +1

    Sir when you printed the value of PI why did we get a white space after it,you didn't add any
    !??

    • @arkknight112
      @arkknight112 4 ปีที่แล้ว


      is used for printing the statment in next line

  • @yanoski9
    @yanoski9 7 หลายเดือนก่อน

    the code at the end doesnot compile on Vs

  • @codewithmadrine7843
    @codewithmadrine7843 ปีที่แล้ว

    8:19 my time output is not right , is there away like to modify timezones in c?

  • @PRAKASH-hp6eg
    @PRAKASH-hp6eg 3 ปีที่แล้ว +1

    Time and date are coming wrong for me🤔

  • @technicalllinone6957
    @technicalllinone6957 3 ปีที่แล้ว

    Hlo sir
    Multiple lines code is not working in #define it's showing error

  • @jabasjabas1434
    @jabasjabas1434 2 ปีที่แล้ว

    Bro i tried in but the out put comes with null

  • @mr.rachetphilanthrophist601
    @mr.rachetphilanthrophist601 4 ปีที่แล้ว +1

    #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.

  • @ArvindKumar-ed4pl
    @ArvindKumar-ed4pl 3 ปีที่แล้ว

    Greater program giving error
    Condition is always false

  • @gunjanlakhlani
    @gunjanlakhlani 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +3

      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.

  • @ashishwagh2586
    @ashishwagh2586 3 ปีที่แล้ว

    Addition programm getting error

  • @phanindrasaikuriti6434
    @phanindrasaikuriti6434 3 ปีที่แล้ว

    When we are getting subtitles , half of the code is can't see.

  • @dr.anubhavkumarprasad5765
    @dr.anubhavkumarprasad5765 4 ปีที่แล้ว +1

    #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 ปีที่แล้ว +1

      @@shubhampathak7926 its correct.
      I figured out the answer.
      its 2+3*2+3 =11.

  • @retrotechnerd
    @retrotechnerd ปีที่แล้ว

    “Lesser than” is grammatically wrong. Use “less than”.

  • @yagneshacharya2461
    @yagneshacharya2461 2 ปีที่แล้ว +1

    views = 167500 and likes = 2700 ,,
    therefore /// views - likes = 164537
    hence 164537 people will go to hell if they doestn't like this video