Emergency !! C Questions

Discussion in 'C' started by frankie123, Jan 8, 2008.

  1. frankie123

    frankie123 New Member

    Joined:
    Jan 8, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    !!! Emergency !!!

    Following are some questions I need answers for

    Please explain your answers

    char my_char;
    int my_ int, a,b,c;
    char my_string[200];
    char* my_c_ptr;


    1.
    my_char = "5423585969770"[my_int];

    a .my_char must be replaced by my_c_ptr
    b.the C syntax is not correct
    c.my_char is assigned to point to a character array of size my_int containing text 5423585969770.
    d. my_char should be replaced by my_string
    e.other


    2.

    enum { one, two, three };

    a.two has value of 3
    b.structure called enum is defined containing 3 elements
    c. three has a value of 1 greater than two
    done , two , three need to be predefined


    3.
    a = b = c == 5;

    a. is equivalet to ((a=b)=c) ==5
    b. the syntax is not correct
    c. aand b will be assigned a value of either 0 or 1
    d. a, b , c are all assigned 5
     
  2. Salem

    Salem New Member

    Joined:
    Nov 15, 2007
    Messages:
    133
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Please don't PM me for 1:1 support.
    http://www.catb.org/~esr/faqs/smart-questions.html#urgent

    > Please explain your answers
    Please explain your lack of an attempt at the solution, or your disregard of the forum posting guidelines.
    http://www.go4expert.com/showthread.php?t=168
    http://www.go4expert.com/faq.php?faq=guidelines
    We're not here to give you answers on a plate so you can get a decent grade you don't deserve.

    You have a guess (or better yet, think about it and refer to some notes) and explain your reasoning, then we tell you where the faults in your reasoning might be.

    The real answer to Q1 isn't even on your list.
     
  3. frankie123

    frankie123 New Member

    Joined:
    Jan 8, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Dear Salem

    regarding Q1. I created he same code which passed by the compiler with no errors raised .

    Q2. regarding definition of enum . The syntax enum variable _name {.....,.....,.... }; I have tried finding if the variable name is optional however every where its there in the syntax.
    i believe (3) to be corect for this question

    Q3. ran program which does assign 0 to both a, b but c gets a number 356, which is not mentioned in the statement. I presume since == returns that s is not equal to 5 , that value is assigned to a and b .
    ans (c)

    I am not trying to break forum rules . I am new to C.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice