Hi all,
I am passing data into a function in C to be edited but that function already returns some data. I was wondering how i could pass data in to a function so that when it is edited it is chnaged universally?? Ive tried using pass by reference:
int myFunction(&dat a)
butthe compiler chucks a wobbly with it. I thought maybe pointers but I need to be explained how to do it.
4 1686
hello friend you cant return more than one value if you use character array otherwise if you want to edit and return more values than use pointer so it goes to memory address and change the value on the address and you do not have to return any thing and you can handle more than one item
hello friend you cant return more than one value if you use character array otherwise if you want to edit and return more values than use pointer so it goes to memory address and change the value on the address and you do not have to return any thing and you can handle more than one item
lol, dw, I am well versed that I cant make multiple returns. could you tell me how to use this pointer and give me an example?
Thanks Goelvivek. that was everything I needed! :-D
gsi 51
New Member
Hi,
Ive tried using pass by reference:
C uses strictly pass by value. Do some thing like, -
-
void func(int *a){ // a declared to be a pointer variable.
-
*a = 100;
-
}
-
-
int main(){
-
int a = 10;
-
func(&a); // Pass the address of variable
-
printf("%d",a); // Prints out 100.
-
return 0;
-
}
-
Thanks,
gsi.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Florent |
last post by:
Hi,
I run a few sites and I want to log in my main site database when/if there
is a problem, (like a page not found or an unknown agent).
But I don't want to give direct access to my database to the other sites, so
how could I safely pass data, (without passwords), from one site to another?
Thanks.
Simon
|
by: Phil Sandler |
last post by:
Hello,
Quick, and possibly strange, question.
I am doing some work testing the running time of some dynamic SQL
statements on a remote machine. What I would like to do is execute
the SQL on the remote machine, without returning the result set to the
calling machine (this would skew the results, as my connection to the
remote machine is rather slow).
|
by: Ben Sharvy |
last post by:
I want to get the user's choice of some menu items, and pass them to a
(PHP) page in the URL, rather than with "Submit" button. I tried
this, but it doesn't work:
<a href="pagetwo.php?says=meaning"><img src="smiley.gif"></a>
Pick one from drop-down menu:
<p>
<form>
<select name=meaning>
|
by: Simon Harvey |
last post by:
Hi,
In my application I get lots of different sorts of information from
databases. As such, a lot of information is stored in DataSets and DataTable
objects.
Up until now, I have been passing around chunks of data in
DataTables/DataSets, simply because that was the format that they were in
when the data was taken from the database. Now, I know this maybe a pretty
silly question with a standard "it depends" answer, but I'm going to...
|
by: Mad Scientist Jr |
last post by:
How do you get a ASP.NET page to return nothing, so the page posting
form data to it doesn't reload?
I have tried all combinations of the following:
Response.SuppressContent = True
Response.BufferOutput = True
Response.Cache.SetNoStore()
| |
by: Marc Castrechini |
last post by:
First off this is a great reference for passing data between the Data Access
and Business Layers:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/Anch_EntDevAppArchPatPrac.asp
I use my own classes in the Business layer. I want to keep the Data Access
layer from requiring these classes so I tried passing a Datarow between the
layers and it seems to work good for me. Constructing the datarow in the
Class...
|
by: Mark Denardo |
last post by:
Hi, I have multi-threaded application that requires one particular thread
(Non-Form based) to receive data from other threads. I know how to pass
control to Form Threads, but I believe there's no way to pass to Non-Form
Threads. So the only two solutions I can think of to handle this situation
is to (1) Keep the Non-Form Thread as is and set up a polling method to
watch for shared variables and respond appropriately, or (2) change the...
|
by: Lonewolf |
last post by:
Hi all,
I'm having difficulties passing data back to managed class from my
native class when the data is generated from within a native thread in
the native class itself. I will give the following runtime error,
" Attempting to call into managed code without transitioning out first.
Do not attempt to run managed code inside low-level native
extensibility points, such as the vectored exception handler, since
doing so can cause corruption...
|
by: moondaddy |
last post by:
I have a htm page where I need to pass some data to an aspx page as a means
of sending data to the database. I don't need to see the aspx page so I was
going to put it in a hidden iframe. This works real good. Since I don't
need the aspx page to do any postback, is there a way to pass a parameter to
it with out it finishing the round trip back to the htm page?
Thanks.
--
moondaddy@newsgroup.nospam
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |