#26 C Struct | C Programming for Beginners

Поделиться
HTML-код
  • Опубликовано: 4 фев 2025

Комментарии • 102

  • @programizstudios
    @programizstudios  2 года назад +5

    🚀 Loved the tutorial? Take it further with Programiz PRO!
    Refine your skills, conquer coding fears, and build confidence with interactive lessons, quizzes, and challenges. Strengthen your programming foundation and master C today!
    👉Start Here: bit.ly/c-master

    • @AbhiramDeshpande-fe1vi
      @AbhiramDeshpande-fe1vi Год назад +1

      #include
      typedef struct complex
      {int real;
      int imaginary;}
      complex;
      int main() {
      complex c1 = {.real=12,.imaginary=9};
      complex c2 = {.real=3,.imaginary=2};
      complex c3 = {.real=7,.imaginary=8};
      complex difference;
      difference.real= c1.real-c2.real-c3.real;
      difference.imaginary=c1.imaginary-c2.imaginary-c3.imaginary;
      printf("the sum is %d%di",difference.real,difference.imaginary);
      return 0;
      }

  • @zindycangaming9851
    @zindycangaming9851 2 месяца назад +24

    Me watching this having my semester exam tommorow 💀💀😭😭

  • @Frank-mu6qy
    @Frank-mu6qy Год назад +5

    Very basic tutorial but high-quality for beginner,expecting more videos for C language

  • @swahifaabdijuma2782
    @swahifaabdijuma2782 Год назад +2

    Amaizing Thank youuuuuuuuu I havew lab of programming tomorrow and is about this thank uuuuuuuuuuuuuuuuuuuuuuuuuuu

  • @tteokmember
    @tteokmember 2 года назад +8

    you have helped many all around the world a lot! thank you so much!

  • @questionbaba
    @questionbaba 2 года назад +4

    I'm also learning c programming language. Your Program learn trick very amazing mam ❤️ Thank you so much love u mam ❤️❤️

  • @tasneembendhia2675
    @tasneembendhia2675 Год назад +39

    I like when she says "let me sow you" instead of "show", it's just so cute

    • @dcpowered
      @dcpowered 4 месяца назад

      How about YOU sow us how to do anything other than make pointless comment.

    • @vitsstee5941
      @vitsstee5941 4 месяца назад

      :D and istead of "third" she says "turd". :D

    • @jakebardinas9296
      @jakebardinas9296 2 месяца назад

      you are so cute

    • @zindycangaming9851
      @zindycangaming9851 2 месяца назад

      How old are you? im guessing 30..🤔

  • @Monji_Mowoud
    @Monji_Mowoud Год назад +1

    Thank you so much. Tnx for sharing your knowledge generously.

  • @wilsonvaler1717
    @wilsonvaler1717 2 года назад +1

    Hi Panoha, i'm from Peru (latinoamerica), your videos are amazing thank for it, that i help me a lots.

  • @satyamyaduvashi-np4qk
    @satyamyaduvashi-np4qk 29 дней назад

    thank u maam.

  • @Abdullah-un8go
    @Abdullah-un8go 11 месяцев назад +1

    i have one question what is the main use for struct as more variable can be take to do the work? Is it related to memory of operation check?

  • @Go.flexrcords
    @Go.flexrcords 2 года назад +1

    Big fan of your sites and videos 😜

  • @srinivaschilla9881
    @srinivaschilla9881 2 года назад +3

    Maadam miruu thopp🔥💥

  • @rancho121
    @rancho121 Год назад

    Your video are crisp and easy to understand

  • @ironmonkey1990
    @ironmonkey1990 11 месяцев назад +1

    very helpfull!

  • @iremtaze6262
    @iremtaze6262 Год назад +1

    Thanks a lot for the video, but I have one question. 9:30 Why did we add "Complex" after the "typedef struct"? We did not use "Complex" anywhere in the last version of the code. And without using it, the program still works.

    • @tylers6071
      @tylers6071 Год назад +2

      This is because she used "typedef" at the beginning of the definition. By doing so, she created an alias of "complex" which represents "struct Complex". So anywhere in the code that you see "complex" that is substituting for "struct Complex".

  • @TonyStark-v4t
    @TonyStark-v4t Год назад

    Mam I need more structure videos such as pointer to structure,self referencial structure and singly linked list please post these videos for me

  • @bennarthurdesouza1624
    @bennarthurdesouza1624 2 года назад

    Thanks for this explanation!

  • @SeyranTaganov
    @SeyranTaganov Месяц назад

    God bless you!

  • @questionbaba
    @questionbaba 2 года назад +4

    At the last in quiz answer will be....(c) firstTest 💥💥💥💥

  • @ikechukwuunegbu7266
    @ikechukwuunegbu7266 2 года назад

    Great job. Thank you for this.

  • @stormstylz3447
    @stormstylz3447 Год назад

    Thank you!

  • @HamsalekhaHamsa-q4q
    @HamsalekhaHamsa-q4q Год назад

    Mam explain this program in the next vedio write a c program to read a sentence and count the number of pf words in the sentence

  • @bryanbalantes6486
    @bryanbalantes6486 Год назад +7

    /*
    Create a program to find the differences
    between three complex numbers.
    * Perform the subtraction between
    complex numbers by subtracting the
    real part of one complex number from
    other complex numbers and same for
    the imaginary part too.
    */
    #include
    //Differences of Complex Numbers
    typedef struct Complex{
    double real;
    double imagine;
    }complex;
    int main(){
    complex c1 = {.real = 45.34, .imagine = 15};
    complex c2 = {.real = 21.34, .imagine = 30};
    complex c3 = {.real = 13.34, .imagine = 10.5};

    complex sub;
    sub.real = c1.real - c2.real - c3.real;
    sub.imagine = c1.imagine - c2.imagine - c3.imagine;
    printf("Result is %.2lf - %.2lfi", sub.real, sub.imagine);

    return 0;
    }

    • @whiteguardist
      @whiteguardist 27 дней назад +1

      it would have been correct if the minus in the printf statement was turned into a plus, since both parts of the number turn out to be negative.

  • @BelalAlobieda
    @BelalAlobieda 2 года назад

    You are the best❤

  • @rancho121
    @rancho121 Год назад

    Thanks ma'am

  • @BakariMaitha
    @BakariMaitha 3 месяца назад

    Is it 'zero' or 'jero'

  • @All4you_
    @All4you_ 2 года назад

    Mam, When will the searching and sorting video come out in this series?

  • @programizstudios
    @programizstudios  2 года назад +10

    Quiz: What is the name of the variable of the following struct?
    struct Test {
    double testScore;
    int testCount;
    } firstTest;
    a. testScore
    b. struct
    c. firstTest
    d. Test

  • @Jarawain_Kharpran
    @Jarawain_Kharpran Год назад

    ty

  • @thiagaodavez5465
    @thiagaodavez5465 Год назад +1

    comment leaved

  • @tanzimkhan4695
    @tanzimkhan4695 Год назад

    Your Laptop Spec. ?🤩🤩

  • @yogithabale
    @yogithabale 7 месяцев назад +3

    opt c , first test

  • @surekingu5719
    @surekingu5719 Год назад

    I try take string value in struct but not work...how to solve.?

  • @jmarkyt5453
    @jmarkyt5453 2 года назад +25

    #include
    #include
    #include
    #include
    typedef struct Complex {
    int real;
    int imagine;
    } complex;
    int main()
    {
    complex c1 = {.real = 10, .imagine = 20};
    complex c2 = {.real = 5, .imagine = 15};
    complex c3 = {.real = 25, .imagine = 30};
    complex minus;
    minus.real = c1.real - c2.real - c3.real;
    minus.imagine = c1.imagine - c2.imagine - c3.imagine;
    printf("Total is: %d and %di", minus.real, minus.imagine);
    return 0;
    }
    OUTPUT:
    Total is: -20 and -25i

    • @dorin.dumitru
      @dorin.dumitru 4 месяца назад

      Why do you load into memory stdbool.h, math.h and string.h libraries?
      You know it's useless? You just use processor clocks for nothing...

  • @oluwatomirhodes795
    @oluwatomirhodes795 10 месяцев назад

    I am having problems with C progamming for engineers I am worried I will not do well on my finaly exam as I need 20%out of 40% to pass. That's what I am here. Seeking help. Please do you have a detailed video as to why you use the typedef and other methods of initializing struts. I don't mined I will pay for it

  • @1NazareeM618
    @1NazareeM618 Год назад

    Thanks

  • @SaiSiddartha-l9o
    @SaiSiddartha-l9o 8 месяцев назад

    Answer is option c mam

  • @PraveenPraveen-us3rp
    @PraveenPraveen-us3rp Год назад +1

    Option : test

  • @twinkleramchandani5193
    @twinkleramchandani5193 5 месяцев назад

    option d

  • @keshavdixit08
    @keshavdixit08 2 года назад

    answer : C

  • @seabasschukwu6988
    @seabasschukwu6988 Год назад

  • @aderolearnsengineering
    @aderolearnsengineering Год назад +1

    C. firstTest

  • @mahisflow1165
    @mahisflow1165 2 года назад

    First test

  • @shaikhmuhammadbakhtawarahm7533
    @shaikhmuhammadbakhtawarahm7533 2 года назад

    first test

  • @kimsannmao5147
    @kimsannmao5147 2 месяца назад

    D

  • @sadewnivihidula5505
    @sadewnivihidula5505 Год назад

    firstTest

  • @aritradey7189
    @aritradey7189 2 года назад

    c.firstTest

  • @vinaykumarvinaykumar2006
    @vinaykumarvinaykumar2006 2 года назад

    My Answer is c

  • @shireldadon-l2t
    @shireldadon-l2t 10 месяцев назад

    typedef struct complexnum {
    int real, imag;
    } complexnum;
    int main() {
    int resultreal, resultimag;
    complexnum c1 = {.real = 8, .imag = 5 };
    complexnum c2 = {.real = 6, .imag = 2 };
    complexnum c3 = {.real = 3, .imag = 7 };
    resultreal = c1.real - c2.real - c3.real;
    resultimag = c1.imag - c2.imag - c3.imag;
    printf("the result is: Z=%d%di
    ", resultreal, resultimag);
    return 0;

  • @imrannazari8642
    @imrannazari8642 2 года назад

    c

  • @prathikantamsaivarnith484
    @prathikantamsaivarnith484 Год назад

    #include
    typedef struct complex{
    double real;
    double imaginary;
    } complex;
    int main(){
    complex c1={.real=23.26 , .imaginary=15.56};
    complex c2={.real=13.26 , .imaginary=5.56};
    complex subtract;
    subtract.real=c1.real - c2.real;
    subtract.imaginary=c1.imaginary - c2.imaginary;
    printf("difference between c1 and c2 is %.2lf + %.2lfi",subtract.real,subtract.imaginary);
    return 0;
    }

  • @onic9623
    @onic9623 Год назад +1

    Option C : firstTest
    ---------------------------------------------------------------------------------
    #include
    typedef struct complex
    {
    double real;
    double imagine;
    }complex;
    int main()
    {
    complex c1 = {.real = 23.56, .imagine = 47.2};
    complex c2 = {.real = 11.28, .imagine = 25.7};
    complex c3 = {.real = 9.38, .imagine = 14.4};
    complex diff;
    diff.real = c1.real - c2.real - c3.real;
    diff.imagine = c1.imagine - c2.imagine - c3.imagine;
    printf("Difference is %.2lf - %.2lfi", diff.real, diff.imagine);
    return 0;
    }

  • @davebull6321
    @davebull6321 Год назад

    # include
    typedef struct Difference {
    double real;
    double imaginary;
    double answer;
    }difference;
    int main() {
    difference c1 = {.real = 34.14, .imaginary = 112.34};
    difference c2 = {.real = 21.12, .imaginary = 80.21};
    difference minus;
    minus.real = c1.real - c2.real;
    minus.imaginary = c1.imaginary - c2.imaginary;
    minus.answer = minus.imaginary - minus.real;
    printf("Result is %.2lf - %.2lf = %.2lf",minus.imaginary,minus.real,minus.answer);
    return 0;
    }

  • @freehug071
    @freehug071 2 года назад +1

    #include
    typedef struct complex{
    double Real;
    double Imaginary;
    } complex;
    int main()
    {
    complex a1 = {.Real = 43.2, .Imaginary =23.32};
    complex a2 = {.Real = 34.44, .Imaginary = 32.33};
    complex sum;
    sum.Real = a1.Real - a2.Real;
    sum.Imaginary = a1.Imaginary - a2.Imaginary;
    printf("the Real of complex is %.1lf
    the Imaginary of complex is %.2lf
    ", sum.Real, sum.Imaginary);
    return 0;
    }

  • @stealthy_doctor
    @stealthy_doctor 5 месяцев назад

    Hello again! i am back at it finally and here is my solution for the Programming task:
    #include
    typedef struct complex{
    double real;
    double imaginary;
    }complex;
    int main(){

    complex num1 = {.real = 121.05, .imaginary = 130.1};
    complex num2 = {.real = 20.05, .imaginary = 30.2};
    complex num3 = {.real = 2, .imaginary = 30.3};
    complex sum;
    sum.real = num1.real - num2.real - num3.real;
    sum.imaginary = num1.imaginary - num2.imaginary - num3.imaginary;
    printf("Result of %.2lf + %.2lfi", sum.real, sum.imaginary);
    return 0;
    }
    and for the quiz i'm thinking C. firstTest because if i'm not mistaken that's how you create a quick nickname thing
    (just fyi i looked it up now its not a nickname, its like you're initializing or declaring a variable of that struct type immediately after defining the structure itself, which i think is neat to know )

  • @JeongWoonKim-i4j
    @JeongWoonKim-i4j Год назад +1

    #include
    typedef struct Complex {
    double real;
    double imagine;
    } complex;
    int main() {
    complex c1 = {.real = 3496.54, .imagine = 67.07};
    complex c2 = {.real = 672.41, .imagine = 23.14};
    complex c3 = {.real = 27.06, .imagine = 42.15};
    complex subtraction;
    subtraction.real = c1.real - c2.real - c3.real;
    subtraction.imagine = c1.imagine - c2.imagine - c3.imagine;
    printf("Result is %.2lf + %.2lfi", subtraction.real, subtraction.imagine);
    return 0;
    }

  • @abdirahmaanabdirashiid
    @abdirahmaanabdirashiid 5 месяцев назад

    #include
    typedef struct complex{
    double real;
    double imagine;
    }complex;
    int main()
    {
    complex x={.real=73.7, .imagine=143.8};
    complex y={.real=45.3, .imagine=112.4};
    complex substract={.real=x.real-y.real, .imagine=x.imagine-y.imagine};
    printf("RESULT: %.1lf + %.1lfi",substract.real,substract.imagine);
    return 0;
    }

  • @bbek300
    @bbek300 9 месяцев назад

    #include
    typedef struct complex{
    double real;
    double imaginary;
    }comp;
    int main() {
    comp c1 = { .real=41.5, .imaginary=20};
    comp c2 = {.real=10.6, .imaginary=5};
    comp c3 = {.real=15.2, .imaginary=2.3};
    comp diff;
    diff.real=c1.real-c2.real-c3.real;
    diff.imaginary=c1.imaginary-c2.imaginary-c3.imaginary;
    printf("The Difference is %.2lf + %.2lfi",diff.real,diff.imaginary);
    return 0;
    }

  • @JASMIN-jg2vn
    @JASMIN-jg2vn 7 месяцев назад

    #include
    typedef struct Complex {
    double real;
    double imagine;
    } complex;
    int main() {
    complex c1 = {.real = 144.8, .imagine = 188.4};
    complex c2 = {.real = 84.6, .imagine = 68.55};
    complex c3 = {.real = 48.9, .imagine = 24.6};
    complex difference;
    difference.real = c1.real - c2.real - c3.real;
    difference.imagine = c1.imagine - c2.imagine - c3.imagine;
    printf("Result is %.2lf + %.2lfi", difference.real, difference.imagine);

    return 0;
    }
    output: Result is 11.30 + 95.25i

  • @huwagmunatayongumuwi
    @huwagmunatayongumuwi 5 месяцев назад

    #include
    typedef struct Complex {

    double real;
    double imaginary;
    } complex ;
    int main() {

    complex num1 = {.real = 123.32, .imaginary = 69};
    complex num2 = {.real = 312.35, .imaginary = 63};
    complex num3 = {.real = 323.32, .imaginary = 609};
    complex difference;
    difference.real = num1.real - num2.real - num3.real ;
    difference.imaginary = num1.imaginary - num2.imaginary - num3.imaginary ;
    printf("The difference of the three complex numbers are %.2lf - %.2lfi ", difference.real, difference.imaginary);
    return 0;
    }

  • @Eileen-in-the-coding-maschine
    @Eileen-in-the-coding-maschine Год назад

    Task:
    #include
    struct Complex {
    double real;
    double imagine;
    };
    int main() {
    struct Complex complex1 = {.real = 35.56, .imagine = 45};
    struct Complex complex2 = {.real = 45.76, .imagine = 75.67};
    struct Complex complex3 = {.real = 105.86, .imagine = 146.98};
    struct Complex sub;
    sub.real = complex3.real - complex2.real - complex1.real;
    sub.imagine = complex3.imagine - complex2.imagine - complex1.imagine;
    printf("Result: %.2lf + %.2lfi ", sub.real, sub.imagine);
    OUTPUT: Result: 24.54 + 26.31i
    Quiz: C is the correct option

  • @countrysideshowyaigrock4689
    @countrysideshowyaigrock4689 Год назад

    #include
    typedef struct Complex {
    double real;
    double imagine;
    } complex;
    int main() {
    complex c1 = {.real = 221.87, .imagine = 330};
    complex c2 = {.real = 13.34, .imagine = 112.23};
    complex c3 = {.real = 27.13, .imagine = 22.16};
    complex sub;
    sub.real = c1.real - c2.real - c3.real;
    sub.imagine = c1.imagine - c2.imagine - c3.imagine;
    printf("Result is %.2lf + %.2lfi", sub.real, sub.imagine);
    return 0;
    }

  • @YUPENGMA-h1y
    @YUPENGMA-h1y Год назад

    #include
    typedef struct Complex{
    double real;
    double imaginary;
    } complex;
    int main(){
    double imaginary;
    complex c1 = {.real =5, imaginary = 2};
    complex c2 = {.real =2, imaginary = 4};
    complex c3 = {.real =7, imaginary = 1};
    complex sub1,sub2,sub3;
    sub1.real = c1.real - c2.real;
    sub2.real = c2.real - c3.real;
    sub3.real = c3.real - c1.real;
    sub1.imaginary = c1.imaginary -c2.imaginary;
    sub2.imaginary = c2.imaginary -c3.imaginary;
    sub3.imaginary = c3.imaginary -c1.imaginary;
    printf("c1- c2 is %.2lf + (%.2lfi)
    ", sub1.real ,sub1.imaginary);
    printf("c2- c3 is %.2lf + (%.2lfi)
    ", sub2.real ,sub2.imaginary);
    printf("c3- c1 is %.2lf + (%.2lfi)", sub3.real ,sub3.imaginary);
    return 0;
    }

  • @swabulabdul2393
    @swabulabdul2393 2 года назад +1

    #include
    typedef struct Numbers{
    double real;
    double imagine;
    }numbers;
    int main(){
    numbers n1 = {.real = 600, .imagine = 300};
    numbers n2 = {.real = 200, .imagine = 200};
    numbers n3 = {.real = 100, .imagine = 100};
    numbers diff;
    diff.real = n1.real - n2.real - n3.real;
    diff.imagine = n1.imagine - n2.imagine - n3.imagine;
    printf("The difference is: %.2lf + %.2lfi", diff.real, diff.imagine);
    return 0;

  • @ndyakuhakiwilberforce9675
    @ndyakuhakiwilberforce9675 6 месяцев назад

    Thanks

  • @JohnKamau-u8j
    @JohnKamau-u8j 10 месяцев назад

    First test

  • @ashirafuSalum
    @ashirafuSalum Год назад

    firstTest

  • @heevar6169
    @heevar6169 Год назад

    #include
    typedef struct Complex {
    double real;
    double imagine;
    }complex;
    int main(){
    complex c1 = {.real = 11.12 , .imagine = 13.14};
    complex c2 = {.real = 14.15 , .imagine = 15.16};
    complex c3 = {.real = 16.17 , .imagine = 17.18};
    complex sub;
    sub.real = (c1.real) - (c2.real) - (c3.real) ;
    sub.imagine = (c1.imagine) - (c2.imagine) - (c3.imagine) ;
    printf("%.2lf + %.2lfi ", sub.real , sub.imagine);


    return 0;
    }