Search:

Type: Posts; User: msp

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    1,025

    so this was a syntax error? really? when i write...

    so this was a syntax error? really?
    when i write it like this:


    char foooo()[10]
    {
    }

    my compiler reports that the function returns array! i am using MSVS .Net 2003.
  2. Replies
    3
    Views
    1,025

    func returning array

    char foooo()[10]
    {
    static char a[10];
    return a;
    }
    I am really screwed up! What's wrong here?
  3. Thread: C/C++ examples

    by msp
    Replies
    19
    Views
    8,537

    Print the binary tree on console in a visual way...

    Print the binary tree on console in a visual way ;)
  4. Thread: local objects

    by msp
    Replies
    10
    Views
    1,256

    Well I tried whatever I could think of but the...

    Well I tried whatever I could think of but the program runs fine.
    So why worry :)
  5. Thread: local objects

    by msp
    Replies
    10
    Views
    1,256

    Yeah Salem I am doing that! But I think (I've...

    Yeah Salem I am doing that!
    But I think (I've seen it in MSVC while writing this example) that the function "push_back"
    takes a reference. So no new copy should have been made.
  6. Thread: local objects

    by msp
    Replies
    10
    Views
    1,256

    I think it is a special case for string objects...

    I think it is a special case for string objects only.
    What if the objects are of other types?
    I am trying to do it with my own objects, and I will post them here.
  7. Thread: local objects

    by msp
    Replies
    10
    Views
    1,256

    Salem, sorry for that stupid error! Now the...

    Salem, sorry for that stupid error!
    Now the program works just fine :shock:
    I am expecting it to show invalid data or make invalid memory errors.
    Why is it working just fine? (Contrary to my...
  8. Thread: local objects

    by msp
    Replies
    10
    Views
    1,256

    local objects - solved

    Here in this code the function "foo" adds local objects to a global list.
    Then the function "bar" tries to access the list. In this simple example it worked.
    (I was expecting some garbage values or...
  9. Thread: C/C++ examples

    by msp
    Replies
    19
    Views
    8,537

    Thanks Salem for pointing this out! I have made...

    Thanks Salem for pointing this out!
    I have made the modifications.
  10. Thread: linker errors?

    by msp
    Replies
    7
    Views
    4,251

    Hi Codeplug! But what these lines are doing in...

    Hi Codeplug!
    But what these lines are doing in his code?
    I think they are supposed to have the same effect?

    #if defined(_MSC_VER)
    #pragma comment(lib, "ole32.lib")
    #pragma comment(lib,...
  11. Thread: C/C++ examples

    by msp
    Replies
    19
    Views
    8,537

    My version of animal guessing game in C: ...

    My version of animal guessing game in C:

    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>

    struct tree_t
    {
    char* item;
    struct tree_t* left;
  12. Replies
    14
    Views
    1,690

    matsp, i tried with gcc -O0 fptr.c but this also...

    matsp, i tried with gcc -O0 fptr.c
    but this also did not help.
    i am making an indirect recursion, through a function ptr, i thought it would work, but ...
  13. Replies
    14
    Views
    1,690

    Even this did not fell into an infinite recursion!

    Even this did not fell into an infinite recursion!
  14. Replies
    14
    Views
    1,690

    Damn! Even this did not work :( int (*foo)...

    Damn!
    Even this did not work :(

    int (*foo) (int, char**);

    int bar(int c, char** a)
    {
    foo = bar;
    foo(c, a);
    }
  15. Replies
    14
    Views
    1,690

    Oh so may be there are some problems related to...

    Oh so may be there are some problems related to recursion of the main method in C.
    Not a problem I will try the above with a different function.
    Thanks.
  16. Replies
    14
    Views
    1,690

    is this infinite recursion?

    I tried this and was expecting it to recurse infinitely (until stack fault).
    But it did not.

    int (*foo) (int, char**);

    int main(int argc, char** argv)
    {
    foo = main;
    ...
  17. Replies
    21
    Views
    3,016

    well ziga, I hope this helps you: #include...

    well ziga, I hope this helps you:

    #include <iostream>
    #include <cstdio>
    using namespace std;

    int main()
    {
    string line;
    getline(cin, line, '\n');
  18. Replies
    21
    Views
    3,016

    :confused: sorry :confused: Could not make any...

    :confused: sorry :confused:
    Could not make any sense of it.
    Just tell me what you want to do?
  19. Thread: C/C++ examples

    by msp
    Replies
    19
    Views
    8,537

    My own auto_ptr implementation: #include...

    My own auto_ptr implementation:

    #include <iostream>
    using namespace std;

    template <typename T>
    class ptr
    {
    T* p;
    public:
  20. Replies
    4
    Views
    1,167

    It works now! Thanks everyone! #include...

    It works now! Thanks everyone!

    #include <iostream>
    #include <cstdlib>
    using namespace std;

    struct Node
    {
    int item;
    Node *left;
  21. Thread: C/C++ examples

    by msp
    Replies
    19
    Views
    8,537

    Yeah iMalc! I am actually a An Idiot at C++ and...

    Yeah iMalc!
    I am actually a An Idiot at C++ and posted my tiny examples here for my own reference and
    any newbie like me (who may see them useful).

    Thanks brewbuck!
  22. Replies
    51
    Views
    6,977

    Yeah! But I am unable to PM him. This is what I...

    Yeah! But I am unable to PM him.
    This is what I get when I try: Error Page
  23. Replies
    51
    Views
    6,977

    I can be (or give you) a mentor for 1 year and...

    I can be (or give you) a mentor for 1 year and even longer time.
    But first tell me how much can you pay? Can you pay me $50 per month?
    Regards.
  24. Thread: C/C++ examples

    by msp
    Replies
    19
    Views
    8,537

    Thanks simpleid! All your examples look very...

    Thanks simpleid!
    All your examples look very useful (have not run yet)!

    Please suggest a better alternative for that!
  25. Replies
    4
    Views
    1,167

    Well I just want it to insert items in tree and...

    Well I just want it to insert items in tree and then print the inserted items.

    Oops! I did not realize that. Thanks.

    Yeah I hope that reference to pointer may work. I'll test it and post....
Results 1 to 25 of 31
Page 1 of 2 1 2