Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Pointer assigned by a function problem...

Reply
Thread Tools

Pointer assigned by a function problem...

 
 
jamaj
Guest
Posts: n/a
 
      09-03-2008
On 2 set, 22:31, vipps...@gmail.com wrote:
> On Sep 3, 4:26 am, jamaj <jama...@gmail.com> wrote:
>
> > On 2 set, 22:19, vipps...@gmail.com wrote:

>
> > > On Sep 3, 4:11 am, vipps...@gmail.com wrote:

>
> > > > On Sep 3, 4:02 am, jamaj <jama...@gmail.com> wrote:

>
>
> No they did not.
>


But they are working in my machine!!! Maybe a bug of gcc... I'm
wasting my time with you. Thanks a lot...

The real program i'm building is now working, and what is important
for me.

Thanks Ian Collins...
Regards,

jamaj
 
Reply With Quote
 
 
 
 
Barry Schwarz
Guest
Posts: n/a
 
      09-03-2008
On Tue, 2 Sep 2008 18:19:06 -0700 (PDT), wrote:

>On Sep 3, 4:11 am, vipps...@gmail.com wrote:
>> On Sep 3, 4:02 am, jamaj <jama...@gmail.com> wrote:

>
><snip>
>
>Ah yes, also there's a memory leak, since you never free *p.
>So add a free(*p); after the last printf, and then add a return 0;


In main, *p is a double. You meant
free(p);

--
Remove del for email
 
Reply With Quote
 
 
 
 
Barry Schwarz
Guest
Posts: n/a
 
      09-03-2008
On Tue, 2 Sep 2008 18:49:09 -0700 (PDT), jamaj <>
wrote:

>On 2 set, 22:31, vipps...@gmail.com wrote:
>> On Sep 3, 4:26 am, jamaj <jama...@gmail.com> wrote:
>>
>> > On 2 set, 22:19, vipps...@gmail.com wrote:

>>
>> > > On Sep 3, 4:11 am, vipps...@gmail.com wrote:

>>
>> > > > On Sep 3, 4:02 am, jamaj <jama...@gmail.com> wrote:

>>
>>
>> No they did not.
>>

>
>But they are working in my machine!!! Maybe a bug of gcc... I'm
>wasting my time with you. Thanks a lot...
>


It is possible you are wasting your time but if so it is because you
are learning bad habits and rejecting efforts to correct them.

>The real program i'm building is now working, and what is important
>for me.


Refusing to correct undefined behavior just because the program
appears to work is a recipe for disaster.

--
Remove del for email
 
Reply With Quote
 
vippstar@gmail.com
Guest
Posts: n/a
 
      09-03-2008
On Sep 3, 6:35 am, Barry Schwarz <schwa...@dqel.com> wrote:
> On Tue, 2 Sep 2008 18:19:06 -0700 (PDT), vipps...@gmail.com wrote:
> >On Sep 3, 4:11 am, vipps...@gmail.com wrote:
> >> On Sep 3, 4:02 am, jamaj <jama...@gmail.com> wrote:

>
> ><snip>

>
> >Ah yes, also there's a memory leak, since you never free *p.
> >So add a free(*p); after the last printf, and then add a return 0;

>
> In main, *p is a double. You meant
> free(p);


Right, thanks for that correction.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Able to call member function with a pointer assigned NULL nsharma78@gmail.com C++ 8 04-19-2006 10:15 AM
diffrence between "function pointer" and "pointer to a function" murgan C Programming 6 12-21-2005 06:01 AM
Value of a pointer to base type when assigned to a derived type Vijai Kalyan C++ 4 09-07-2005 05:12 AM
pointer to member function and pointer to constant member function Fraser Ross C++ 4 08-14-2004 06:00 PM
function pointer and member function pointer question glen stark C++ 2 10-10-2003 01:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57