+ Reply to Thread
Results 1 to 3 of 3

Thread: C++ Contest-9

  1. #1
    Moderator
    Join Date
    Feb 2006
    Posts
    1,419
    Rep Power
    25
    Answer the follwoing
    1. What can I safely assume about the initial values of variables which are not explicitly initialized?

    2. Why can’t I initialize a local array with a string?
    3. What is the difference between char a[] = “string”; and char *p = “string”; ?


    4. How do I initialize a pointer to a function?
    \"Winners don\'t do different things.They do things Differently\"

  2. #2
    Member
    Join Date
    Apr 2006
    Location
    India
    Posts
    62
    Rep Power
    8
    1. It will have some junk value if you are not initialized explicitly.

    2. I think we can do this(We can initialize a local array with a string).



    3. char a[]= "string"; --> we can not change the base address like a++.


    char* p = "string"; -----> it will allow to do modifications like p++ etc.


    4.int (*ptrFunction)(float, char, char) = NULL;


    Thanks,

    Veeru,

    Bangalore.

  3. #3
    Senior Member
    Join Date
    Mar 2006
    Posts
    607
    Rep Power
    16


    Hi,


    4.type (*fptr) ();


    fptr=pointer to a function


    \"A GREAT PLEASURE IN LIFE IS DOING WHAT PEOPLE SAY YOU CANNOT DO\".

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Content Relevant URLs by vBSEO 3.5.1 PL1