Hi ,
I'm a newbe to programming and have a small question:
I made a small program with a class. in the class's header file I have
: double *ptr_output;
Void main()
{
double result[4];
class class_name(4); //constructor
class.method(re sult);
}
class.method(do uble *output)
{
memcpy(output,p tr_output,4);
}
class constructor
{
ptr_output = new double[length];
}
Why doesn't this work ? I want the method to peform some work on the
data and then return it to the result array.
Please help
--
Gena
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ 1 1242
Gena wrote: Hi ,
I'm a newbe to programming and have a small question:
I made a small program with a class. in the class's header file I have : double *ptr_output;
Void main() { double result[4];
class class_name(4); //constructor
class.method(re sult); }
class.method(do uble *output) { memcpy(output,p tr_output,4);
Apart from numerous syntax errors, the most obvious problem is the line
above. It should be:
memcpy(output,p tr_output,4 * sizeof ptr_output[0]);
memcpy takes a byte count, but doubles are bigger than 1 byte, so you
need to multiply up by sizeof(double). I've used sizeof ptr_output[0] in
case you ever change the type of ptr_output (e.g. to long double or float).
Why didn't you copy-and-paste your real code? Surely that's quicker than
typing it out again?
Tom This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: VijayShankar |
last post by:
Can u be more specific on your question
Anyway its not like Session variables are available for
sometime and not available for sometime.
When your session starts it is very much available unless
your session ends
One more thing Session variables can very much be used in
Application events
|
by: Carolyn Gill |
last post by:
I have already created an asp login/database for a learning/quiz section on
a small site. There will be multiple quizzes through the site and what I
need now would be help: tutorials or advice that a complete novice can
understand/follow to create the following:
A small simple quiz--for now each has just one question with 5 multi-choice
buttons. On submit should send the answer to A) a database (using access for
now) to track scoring...
|
by: bojiokia |
last post by:
I have started school for just 3 weeks,and totally new to c++,what i
learn is just cin n cout
and i received this project, omg, i am totally lost in what the
question wanted me to input?
http://s22.yousendit.com/d.aspx?id=0FJE4MQAJUPW20FJCSFIEQ6VES
Is thre any one who k help me with it? do email me at
bb32_fong@yahoo.com.sg
|
by: David Hearn |
last post by:
I am using VS2005 now and have been used to the XCopy deployment way of
doing things with VS2003. When I made a change to a page, I simply copied
the new ASPX page up. If I made a change to the code behind, I would copy
the new DLL to the BIN directory and obviously, if I made a change to both,
I copied both. Now with VS2005, I have figured out the publish thing and it
works fine except that when I publish a site, it deletes everything in...
|
by: news.microsoft.com |
last post by:
I am starting to work with ASP.NET but am finding so many options that I am
getting confused and would appreciate some advice.
I have developed several ACCESS databases that we use internally and ASP
pages to make some of the information available on our company website -
this works very well and I like the flexibility of both Access forms and ASP
web
Our site has low traffic with never more than 3 on at any time - mostly I
get...
| |
by: David Van D |
last post by:
Hi there,
A few weeks until I begin my journey towards a degree in Computer
Science at Canterbury University in New Zealand,
Anyway the course tutors are going to be teaching us JAVA wth bluej and
I was wondering if anyone here would be able to give me some tips for
young players such as myself, for learning the language.
Is this the best Newsgroup for support with JAVA?
|
by: arcticool |
last post by:
I had an interview today and I got destroyed :(
The question was why have a stack and a heap?
I could answer all the practical stuff like value types live on the
stack, enums are on the stack, as are structs, where classes are on
the heap... when value types go out of scope the memory is re-
allocated, object remain in memory waiting to be cleaned up by the
garbage collector, etc, but he responded 'so why not just put say a
class on the...
|
by: crazy works |
last post by:
hello,
i have a small hard question , i really wish to find the answer soon here because iam look for that answer
for 3 days and i got no success ,
well , iam not a professional in the php programming but iam trying to be good as i can on it
so about the question , just iam trying to complete my second script programming , i want to make adding topics system
, i want to let the visitor be able to add any mount of pictures inside...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |