Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Blind4Basics
    @Blind4Basics
    a reference to the instance of the object, rather (in JS/python). But a pointer could be fine too, I guess
    Hussam sindhu
    @hussamsindhu
    right thanks mean i m right
    hobovsky
    @hobovsky

    i mean pointer is just object reference

    No. Kinda. It depends.

    obj=new cycle()
    obj is pointer ?

    No. Yes. It depends.

    Actually if you are not working with C, C++, or unmanaged memory in general, you should avoid term "pointer" all along.

    Hussam sindhu
    @hussamsindhu
    right actually i studied some thing in which he refer pointer in the next of the node so that's why i asked
    in python or Js we just put Object reference in next but in c he refers pointers
    but i understand the main concept
    Hussam sindhu
    @hussamsindhu
    try{
      return ls[index]
      }catch(e){return e}
    this is not working for these error
    image.png
    Blind4Basics
    @Blind4Basics
    should THROW an error, not return it...
    so why are you even catching the error??
    Hussam sindhu
    @hussamsindhu
    actually i see the syntax how to handle error
    in this theretry catch so i'll try on this
    Blind4Basics
    @Blind4Basics
    read more carefully the specs: do you have to handle the errors on your side?
    Hussam sindhu
    @hussamsindhu
    there is throw also but i don't understand where to use
    right
    they tell me or asking me to throw error
    Blind4Basics
    @Blind4Basics
    not you, your code.
    any part of it
    (even a builtin)
    Hussam sindhu
    @hussamsindhu
    so i should must handle the situation
    like throw it ?
    Blind4Basics
    @Blind4Basics
    just try to not handle it, you'll see
    Hussam sindhu
    @hussamsindhu
    okay right
    Hussam sindhu
    @hussamsindhu
    don't understand what to do :/
    hobovsky
    @hobovsky
    In this kata: https://www.codewars.com/kata/hide-from-the-sun
    I have problem finding the position of Sun. Does it rise directly on the east of me, sets exactly westwards, and travels totally vertically, up to and down from the zenith point?
    hobovsky
    @hobovsky
    hmm the fact that day lasts 12 hours seems to imply the rising and setting points on horizon. Remaining question is, how is the path of the Sun defined through the day
    Blind4Basics
    @Blind4Basics

    Keep in mind that there is no floor; at night the sun will burn from below you.

    ?

    (with the picture, it would surely be easier, but... x) )
    hobovsky
    @hobovsky
    it means that there is no ground which would cast the shadow when sun sets below the horizon
    Blind4Basics
    @Blind4Basics
    x)
    I was actually asking if you didn't forgot that part ;)
    sounds you didn't
    hobovsky
    @hobovsky
    no, and actually I do not think it brings much to the problem. It saves you one condition check
    Hussam sindhu
    @hussamsindhu
    every case is handled except in which index is -1 if index is 100 handle by exception if it 3 it's handle if node is none it's handle if it -1 why it did not handle it
    Romarub
    @Romarub
    Could anybody help me to find out the problem in my program? It seems like something is wrong with the return value format, because if I test the program on my PC compiler I get the required result.
    This kata: https://www.codewars.com/kata/reverse-words/train/c
    Task
    image.png
    error I get
    Hussam sindhu
    @hussamsindhu
    yeah
    Romarub
    @Romarub
    image.png

    My solution is

    include <stdlib.h>

    include <string.h>

    char reverseWords(const char text) {
    int i, n;

    char tmp;
    char output[300];
    char *s, *res;
    strcpy (output, "");
    strcpy (output, text);
    res = s = output;
        while(*(s+=strspn(s, " \t\n"))) {
            n = strcspn(s, " \t \n");
            for (i=0; i<n-1; i++, n--) {
                tmp = *(s+i);
                *(s+i)=*(s+n-1);
                *(s+n-1)=tmp;
            }
        s+=strcspn(s," \t\n");
        }

    return res;
    }

    Hussam sindhu
    @hussamsindhu
    if i do this kata how i do that like
    actually i never do c language :(
    if you want to do this in some other language i guide you there but i don't know how c++ works
    Romarub
    @Romarub
    Thank you, but I need to understand C language =)
    Hussam sindhu
    @hussamsindhu
    :) best of luck :thumbsup:
    Hussam sindhu
    @hussamsindhu
    c++ syntax looks very dangerous ;-)
    hobovsky
    @hobovsky
    There is a problem with memory management in your code
    your returned buffer gets corrupted on return