Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

sam_psycho

@sam_psycho
About
Posts
82
Topics
38
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • time and space complexity?
    S sam_psycho

    CPallini wrote:

    Oh, no : too complex, both in space and time. Big Grin

    really? but I dont think it is toooooo complex... :laugh:

    C / C++ / MFC algorithms question

  • pointer
    S sam_psycho

    u need this [^]

    C / C++ / MFC question data-structures

  • time and space complexity?
    S sam_psycho

    ohhh... I tried dis...but I didnt get wot I wanted exacly..

    C / C++ / MFC algorithms question

  • time and space complexity?
    S sam_psycho

    Is their any standard formula to calculate time and space complexity of algo or please give me link to all above things r given..

    C / C++ / MFC algorithms question

  • void pointer?
    S sam_psycho

    Joe Woodbury wrote:

    I don't understand why you are using a void*

    Just I wanted to check that is is possible to print array using void*, You helped me a lot and I Could, thanks. Last one Q.:

    ptr = (int*)ptr + 1;

    In this case,I don't understand why you incremented by 1, size of int is 2, ptr is void* but we are converting it into int so suppose to be incremented by 2; but it fails and how above code works fine ?

    C / C++ / MFC question data-structures

  • void pointer?
    S sam_psycho

    Joe Woodbury wrote:

    The point is that you could do *(int*)ptr.

    is working fine, But I want to print array so I tried following code which is not working, So can you please make it workable.

    int arr[]={10,20,3,6};
    void *ptr=(void *)arr;
    int i=3;
    while(i--)
    {
    printf(" %d",(*(int *)ptr));
    (int *)ptr+=2;
    }

    C / C++ / MFC question data-structures

  • void pointer?
    S sam_psycho

    Joe Woodbury wrote:

    printf expects you to pass a value as an argument. By definition you can't resolve a void pointer.

    Agree with you..:thumbsup:

    Joe Woodbury wrote:

    Be happy;

    Here too...:thumbsup: BUT,

    Joe Woodbury wrote:

    in the past the compiler wouldn't stop you from being stupid.

    Is this solution to the problem I asked? :sigh:

    C / C++ / MFC question data-structures

  • void pointer?
    S sam_psycho

    To print array compiler giving error: I tried following code but It is not working,

    int arr[]={10,20,3};
    void *ptr=(void *)arr;
    printf("%d",*ptr); // getting error on this line

    So, please any suggestion to print array using void pointer, And most imp why compiler not allowing above code .. :confused:

    C / C++ / MFC question data-structures

  • void pointer?
    S sam_psycho

    How can I store address of integer array to void pointer and print array using void pointer?

    C / C++ / MFC question data-structures

  • const in class as a member variable?
    S sam_psycho

    who is lying compiler or you?..but I should believe in compiler and it says that error: c:\test.cpp 6: cannot initialize class member here try this code

    class temp
    {
    static const int i=10;
    };
    void main()
    {
    }

    C / C++ / MFC tutorial question

  • what happens in following code exactly? [modified]
    S sam_psycho

    yes.. it's

    if(function)

    and thanx ..I got it.

    C / C++ / MFC question

  • what happens in following code exactly? [modified]
    S sam_psycho

    what happens with if condition in following code?

    int function(int i)
    {
    printf("inside function");
    return 0;
    }

    int main()
    {
    if(function)
    printf("hi");
    else
    printf("bye");
    }

    and output is only hi why compiler doesn't complaints about wrong function call? :confused:

    modified on Thursday, July 23, 2009 12:08 PM

    C / C++ / MFC question

  • const in class as a member variable?
    S sam_psycho

    from above discussion I have come to conclusion that compiler does not allow any type of initialization in class, so statement

    static const int c = 299792458;

    in your code also creating problem... :(

    C / C++ / MFC tutorial question

  • const in class as a member variable?
    S sam_psycho

    This is working fine

    MyClass::MyClass() : myConstInt(5)
    {
    }

    but it is not possible,

    class MyClass
    {
    const int myConstInt = 5;
    }

    compiler is giving error, So I guess only one way to initialize const in a class..

    C / C++ / MFC tutorial question

  • const in class as a member variable?
    S sam_psycho

    Is it possible to declare member variable of class as a const, if yes,please give me 1 example how to initialize it and if not, why?

    C / C++ / MFC tutorial question

  • [Message Deleted]
    S sam_psycho

    [Message Deleted]

    C / C++ / MFC

  • why it prints 3?
    S sam_psycho

    but if your are assigning any thing to any variable(in our case a=0), this statement suppose to a true, and a=1 does, but what is wrong with zero?

    C / C++ / MFC question

  • why it prints 3?
    S sam_psycho

    Can anybody tell me why value of b is 3 in this code? what happens with (a=0) exactly?

    int a=0;
    int b=(a=0)?2:3;
    cout<

    C / C++ / MFC question

  • why we can't overload .,-&gt;, :: operators?
    S sam_psycho

    Thnx very good link....i got many things cleared :)

    C / C++ / MFC question

  • why we can't overload .,-&gt;, :: operators?
    S sam_psycho

    why we can't overload .,->, :: operators?

    C / C++ / MFC question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups