Search:

Type: Posts; User: eklavya8

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Thread: macro problem

    by eklavya8
    Replies
    11
    Views
    2,810

    macro problem

    if I have a macro defined as




    #define swap(a,b,c) c t; t=a,a=b,b=t;



    The above would work if a,b were numbers and 'c' was a data type like int.but it wont work for float * or any...
  2. Replies
    6
    Views
    1,148

    struct problem

    hi if i have a struct as given below-


    struct a
    {
    char *name;
    int i;
    }ob;

    main()
  3. Replies
    5
    Views
    32,620

    int a[]={1,5,6,8}; for(int j=0;j

    int a[]={1,5,6,8};
    for(int j=0;j<5;j++)
    {
    printf("%d",*a);
    a++;
    }


    gives this error,ny idea why?
  4. Thread: pointers

    by eklavya8
    Replies
    3
    Views
    1,248

    yes i thought so too,but as i mentioned the...

    yes i thought so too,but as i mentioned the pointers dont seem to change there current location even after the statement.
  5. Replies
    5
    Views
    32,620

    Lvalue required error

    when do we get an lvalue required error and an rvalue required error.
  6. Thread: pointers

    by eklavya8
    Replies
    3
    Views
    1,248

    pointers

    ok,
    say x and y are pointers to mem loc 500.
    what does the stmt-
    y++=x++ do;

    where do x and y point now?why?
    apparently they point to the same loc but i dunno why?
  7. Thread: typecasting

    by eklavya8
    Replies
    9
    Views
    2,311

    thanks all of u. very grateful.

    thanks all of u.
    very grateful.
  8. Thread: typecasting

    by eklavya8
    Replies
    9
    Views
    2,311

    ok p=arr;//missed that

    ok
    p=arr;//missed that
  9. Thread: typecasting

    by eklavya8
    Replies
    9
    Views
    2,311

    int arr[3]={2,3,4}; char *p; p=(int *) (p+1) ...

    int arr[3]={2,3,4};
    char *p;
    p=(int *) (p+1)

    printf("%d",*p)


    now p has value 0 why?
  10. Thread: typecasting

    by eklavya8
    Replies
    9
    Views
    2,311

    i am sorry i meant the other way round. final...

    i am sorry i meant the other way round. final answer is in char.
    so can i assume that in this case the higher order bits will be lost?
  11. Thread: typecasting

    by eklavya8
    Replies
    9
    Views
    2,311

    typecasting

    when we type cast a char to an int do we end up with the lower order bits or the higher order?
  12. Replies
    4
    Views
    1,595

    freaky output!

    Can any one tell me why the out put is "1 40 0" and not "1 40 1"


    main()
    {
    int x;
    printf("%d%d%d",x<=50,x=40,x>=10);
    getch();
    }
  13. Thread: big integer

    by eklavya8
    Replies
    2
    Views
    1,116

    big integer

    hi!
    does any one have a prewritten class for handling really big integers(100 digits....).
    Just basic operations
    Its really helpful in coding contests, like java has the inbuilt BigInteger class....
  14. Replies
    2
    Views
    1,387

    Thanx for pointing me in the right direction- ...

    Thanx for pointing me in the right direction-

    vector< vector<int> > myvec(n,vector<int>(n));

    works perfectly!
    cheers!
  15. Replies
    2
    Views
    1,387

    2d dynamic array

    hi!
    does anyone know a good way to implement dynamic 2d array in c++ using STL?
  16. Replies
    5
    Views
    1,316

    code optimizatio

    could anyone tell me why code 1 is slower than the second code-


    #define sz(a) int((a).size())
    #define pb push_back
    #define all(c) (c).begin(),(c).end()
    #define REP(i,n) for(i=0;i<n;++i)...
  17. Thread: stl error

    by eklavya8
    Replies
    8
    Views
    2,486

    thanks a lot!

    thanks a lot!
  18. Thread: stl error

    by eklavya8
    Replies
    8
    Views
    2,486

    hi all! Thanx for all the help. the line int...

    hi all!
    Thanx for all the help.
    the line
    int start=bossHealth.begin()-find(all(bossHealth),min_element(all(bossHealth) ) );

    had the bug so I replaced it and now i am fine,but I still cant...
  19. Thread: stl error

    by eklavya8
    Replies
    8
    Views
    2,486

    #include #include #include...

    #include <vector>
    #include <list>
    #include <map>
    #include <set>
    #include <deque>
    #include <stack>
    #include <bitset>
    #include <algorithm>
    #include <functional>
    #include <numeric>
  20. Thread: stl error

    by eklavya8
    Replies
    8
    Views
    2,486

    stl error

    Hi!
    dont spend more than 10 minutes reading this,I probably should not even be posting this.
    Any way I have this piece of code which has some syntax error in the STL part and I cannot make any...
  21. Replies
    9
    Views
    9,443

    thanks all!

    thank you all some really nice stuff learnt.
  22. Replies
    9
    Views
    9,443

    2d array of booleans

    Hi!
    Does any one know the best war to create a 2dimensional array of booleans.
    I know how to create a 1D array using bitset but cant go any further.
    Cheers!
    PS:can u tell me a little about the...
  23. Replies
    8
    Views
    1,386

    Thanks to all of you (Mats in particular)! ...

    Thanks to all of you (Mats in particular)!

    cin.ignore() worked perfectly.(yes I did have a cin>>x statement).

    Thanks once again ,I learnt something new .
    cheers!
    ps:In general what are the...
  24. Replies
    8
    Views
    1,386

    Wierd Problem with inputting.

    In the following code why does the getline statement get skipped in the first iteration.



    vector<string> names(r);

    for(i=0;i<r;i++)
    {
    getline(cin,names[i],'\n');
    cout<<i<<endl;
  25. Replies
    11
    Views
    8,017

    i had tried this method but it seems to be giving...

    i had tried this method but it seems to be giving huge "STL style" errors.
Results 1 to 25 of 31
Page 1 of 2 1 2