Ternary Operator | C++ Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ก.ย. 2022
  • How to use the ternary operator in C++. Source code: github.com/portfoliocourses/c.... Check out www.portfoliocourses.com to build a portfolio that will impress employers!

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

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

    Superb

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

    my I ask which editor is it?

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

    Sir pls let me know why this program is not working

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

    Is that the only ternary operator in c++??

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

    Its urgent

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

    /*binary search program using dynamic allocation of strings */
    #include
    #include
    #include
    void main()
    {
    int i,mid,low,high,n,s;
    char **a,**key;
    printf("enter the number of strings of n
    ");
    scanf("%d",&n);
    a=(char **)malloc(n*sizeof(char *));
    key=(char **)malloc(1*sizeof(char *));
    for(i=0;i

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

      It looks like you want to use key to store a string, but you have declared key as char ** and used malloc twice with it, once as if it is char ** and then as if it is char *. That seems really unusual to me, I think you want key to be a char * so you can dynamically allocate space to store a string to be the key.
      These videos might help you out and give you ideas to solve the problem you are trying to solve:
      Binary Search Algorithm: th-cam.com/video/Uuyv88Tn9iU/w-d-xo.html
      Dynamically Allocate Memory for Array Of Strings: th-cam.com/video/4_2BEgOFd0E/w-d-xo.html
      Sorting An Array Of Strings: th-cam.com/video/LZNxRSoEG2M/w-d-xo.html