dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: zio_mangrovia

Page 1 of 3 1 2 3

Search: Search took 0.05 seconds.

  1. Replies
    14
    Views
    615

    Re: struct to vector

    Thanks for your references.
    About this code
    vector<point> pp{temp}
    It uses the copy constructor ?
  2. Replies
    14
    Views
    615

    Re: struct to vector

    What means move semantics?
  3. Replies
    14
    Views
    615

    Re: struct to vector

    here, I made a mistake to type "pushback".




    I don't remember, this statement defines pp as vector of 'point' struct elements and it uses copy constructor to copy temp to vector element?
  4. Replies
    14
    Views
    615

    Re: struct to vector

    Yes; I did but I was interesting to method to make it and if It exists another way, like initialization lists which I don't remember.
  5. Replies
    14
    Views
    615

    struct to vector

    I have to allocate vector with several elements of 'point' type, where its values are collected by cin command.

    I have this structure:


    struct point {
    int x;
    int y;
    };
  6. Re: pass 2-dim matrix by pointer

    thanks for your wonderful explanation
  7. Re: pass 2-dim matrix by pointer

    Your words explained me several things and now I can just understand.



    I also could write somma((double*)mat[0], 3, 5) ? because mat[0] represents address of first line of array and casting...
  8. Re: pass 2-dim matrix by pointer

    This method is been applied from academic people for education purpose and I have to follow these way, but first of all I have to understand it.
    I can understand It's not a good practise but I have...
  9. Re: pass 2-dim matrix by pointer

    I quickly wrote this code to highlight the parameters pass but I will correct it immediately


    double somma(double* m, const int row, const int col)
    {
    double tot=0;
    for (int r=0; r<row;...
  10. [RESOLVED] pass 2-dim matrix by pointer

    somma(double* m, int row, int col)
    {
    double tot=0;
    for (int r=0; r<row; r++)
    for (int c=0; c<col; c++)
    tot+=*(m+r*col+c);
    }

    int R=3, C=7;
    double mat[R][C]={...
  11. Replies
    17
    Views
    1,135

    Re: C++ constant pointer

    Thanks again for your patience:wave:!
  12. Replies
    17
    Views
    1,135

    Re: C++ constant pointer

    a1 is a constant pointer, you can change every value of array that is 'test'
    a2 and a3 are the same: you cannot change array values, that is "test" data.


    It was answer I'm searching!



    p1:...
  13. Replies
    17
    Views
    1,135

    Re: C++ constant pointer

    Excuse me 2kaud, you are very patient and kind, so I can add:


    It's a particular case for array because when you have <type> *, you have 2 different concepts which you described deeply in...
  14. Replies
    5
    Views
    447

    Re: expression precedence

    Conclusion: if operators have same precedence (first case without () ) It's necessary follow associativity criteria that, in this case, It's Left to Right.
    right?

    Thank you very much
  15. Replies
    5
    Views
    447

    Re: expression precedence

    That's right. But It was to understand precedence criteria.
  16. Replies
    17
    Views
    1,135

    Re: C++ constant pointer

    error: assignment of read-only location 'test2[0]'

    so the following statements are equivalent?
    char const test2[] = "test2";
    const char test2[] = "test2";
  17. Replies
    17
    Views
    1,135

    Re: C++ constant pointer

    You are very explicit (I just understood your examples) but It's missing this case:

    char hello[] = "test" vs char const hello[] = "test"



    you said:hello is a const pointer.

    When you...
  18. Replies
    5
    Views
    447

    [RESOLVED] expression precedence

    I'd like to be sure to understand operators precedence in expression:

    The */ % operators have the same precedence and theirs associativity is left to right, so if I have:

    My question: if...
  19. Replies
    17
    Views
    1,135

    Re: C++ constant pointer

    Dear 2kaud,
    I understood both concepts and I'm not contesting you that it does permit the contents of memory pointed to by first to change.
    In this moment I'd to like to concentrate only to one of...
  20. Replies
    17
    Views
    1,135

    Re: C++ constant pointer

    But It's different compared to pointers case, because char* const first permits to not change memory address which is contained in first. If first=0x45663df I cannot change this value inside first....
  21. Replies
    17
    Views
    1,135

    Re: C++ constant pointer

    I studied and understood right difference among constant pointer to memory that can be changed and pointer to constant.
    I explained wrongly.

    My doubt is about array , example:


    char const...
  22. Replies
    17
    Views
    1,135

    [RESOLVED] C++ constant pointer

    void fun(char *s); // It doesn't change string
    int main() {
    char const hello[] = “test“;
    fun(hello) // error!!!!!
    // cannot convert parameter 1 from 'const char [5]' to 'char *‘
    ...
  23. Replies
    2
    Views
    504

    Re: string and char '\n'

    ooppps !!! Excuse me
  24. Replies
    2
    Views
    504

    [RESOLVED] string and char '\n'

    I don't try to understand


    tab=new char*[rig];
    for (int i=0; i<rig; i++)
    tab[i]=new char[col+1];
    for (int r=0; r<rig; r++)
    for (int c=0; c<col+1; c++)
    tab[r][c]='\n';
  25. Replies
    5
    Views
    683

    Re: friend function

    OK I removed it before to paste code, but I can add it again.

    #include <iostream>
    using namespace std;



    I know, infact compiler gave me error. Inside operator- function, I'd like to invoke...
Results 1 to 25 of 72
Page 1 of 3 1 2 3


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)