User Profile

Collapse

Profile Sidebar

Collapse
amonsch
amonsch
Last Activity: Aug 6 '09, 07:39 PM
Joined: Nov 19 '08
Location: Northern Europe
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Pointer Swap local vs. global func, whats the difference?

    Hi,

    does anyone know what the difference is between:

    Code:
    #include <iostream>
    
    using std::cout; 
    using std::endl;
    
    void func( int *p1, int* p2 )
    {
    	p2 = p1;
    }
    
    int main(int argc, char* argv[]) {
    	int* p2;
    	int* p1 = new int;
    	
    	func(p1, p2);
    	
    	cout << "P1 Address: " << p1 <<
    ...
    See more | Go to post

  • amonsch
    replied to Using friend classes
    in C
    hm..

    maybe :
    Code:
    using namespace std;
    could help you. Or could you give us the compiler message ?

    ---
    amonsch
    See more | Go to post

    Leave a comment:


  • amonsch
    replied to Modifying data in file
    in C
    Code:
    fstream modData("Department1.txt",ios::out || ios::in || ios::binary);
    you need to use the bitwise inclusive or-operator ( | ) not the relational or-operator( || )

    ---
    amonsch
    See more | Go to post

    Leave a comment:


  • amonsch
    replied to to Use close(int) from< unistd.h > in QT
    in C
    maybe.

    you should try including stdio.h and using

    FILE * fopen ( const char * filename, const char * mode )
    int fclose ( FILE * stream )

    EDIT:
    but if you are using Qt you should definitely use an object of the QFile class.

    ---
    amonsch
    See more | Go to post

    Leave a comment:


  • @weaknessforcat s

    Wow, your snippet knocked me almost off my seat :)
    BUT, after i played a little bit with the code it seems to me that this behaviour is c++ related, because the Code below is analog to yours only written in C and shows the expected output.
    Hmm.. do you have an explanation ?

    P.S.
    it is a little bit off topic and sorry for my poor english.

    Thanks for all replies!...
    See more | Go to post
    Last edited by amonsch; Nov 21 '08, 07:25 PM. Reason: typo in closing code tag

    Leave a comment:


  • amonsch
    started a topic How do explicit casts affect program performance ?
    in C

    How do explicit casts affect program performance ?

    So as you all can see i would like to know how an explicit cast influences the performance of a program.

    Thank you!
    See more | Go to post
No activity results to display
Show More
Working...