473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Function not working

KL
I have the following function:

void fillvaluecheck (int valuecheck[], int size){
for (int m = 0; m < size; m++){
cout << valuecheck[m] << endl;
valuecheck[m] = 0;
cout << valuecheck[m] << endl;
}
return;
}

I have the two cout statements only to verify that the function was
working correctly. Well, it is not doing anything that I can tell. I
want to fill my valuecheck array with all zeros. What am I possibly
doing wrong?

KL

Jul 23 '05 #1
4 1817
KL wrote:
I have the two cout statements only to verify that the function was
working correctly. Well, it is not doing anything that I can tell. I
want to fill my valuecheck array with all zeros. What am I possibly
doing wrong?


Hi KL,

There is nothing specifically wrong with the function itself. However, many
things can go wrong depending on how and with what parameters you call the
function. Please provide a complete program that shows how you call the
function and the output that you obtain.

Thanks,
--
CrayzeeWulf
Jul 23 '05 #2
KL wrote:
I have the following function:

void fillvaluecheck (int valuecheck[], int size){
for (int m = 0; m < size; m++){
cout << valuecheck[m] << endl;
valuecheck[m] = 0;
cout << valuecheck[m] << endl;
}
return;
}

I have the two cout statements only to verify that the function was
working correctly. Well, it is not doing anything that I can tell. I
want to fill my valuecheck array with all zeros. What am I possibly
doing wrong?

KL


KL,

Your function itself looks fine. Look at the following code and see if
it helps at all.

$ cat test.cpp
#include <iostream>
using namespace std;

void fillvaluecheck(int valuecheck[], int size) {
for(int m = 0; m < size; m++) {
cout << valuecheck[m] << endl;
valuecheck[m] = 0;
cout << valuecheck[m] << endl;
}
}

int main() {
int valuecheck[10];
fillvaluecheck(valuecheck, 10);
return 0;
}

ken@ken-wn0vf73qmks ~/c
$ ./test
-1
0
2088773120
0
2088772930
0
2089866642
0
2088803259
0
1896
0
2289608
0
1628013867
0
1896
0
-1
0
Jul 23 '05 #3
"KL" <kl*******@aol.com> wrote in
news:11*********************@g14g2000cwa.googlegro ups.com:
I have the following function:

void fillvaluecheck (int valuecheck[], int size){
for (int m = 0; m < size; m++){
cout << valuecheck[m] << endl;
valuecheck[m] = 0;
cout << valuecheck[m] << endl;
}
return;
}

I have the two cout statements only to verify that the function was
working correctly. Well, it is not doing anything that I can tell. I
want to fill my valuecheck array with all zeros. What am I possibly
doing wrong?

KL


In your call to fillvaluecheck is size greater than zero??

Alan
Jul 23 '05 #4
KL
Yeppers...it was all the way I was calling it.... Darned functions
anyway.

KL

Ken Human wrote:
KL wrote:
I have the following function:

void fillvaluecheck (int valuecheck[], int size){
for (int m = 0; m < size; m++){
cout << valuecheck[m] << endl;
valuecheck[m] = 0;
cout << valuecheck[m] << endl;
}
return;
}

I have the two cout statements only to verify that the function was
working correctly. Well, it is not doing anything that I can tell. I want to fill my valuecheck array with all zeros. What am I possibly doing wrong?

KL

KL,

Your function itself looks fine. Look at the following code and see

if it helps at all.

$ cat test.cpp
#include <iostream>
using namespace std;

void fillvaluecheck(int valuecheck[], int size) {
for(int m = 0; m < size; m++) {
cout << valuecheck[m] << endl;
valuecheck[m] = 0;
cout << valuecheck[m] << endl;
}
}

int main() {
int valuecheck[10];
fillvaluecheck(valuecheck, 10);
return 0;
}

ken@ken-wn0vf73qmks ~/c
$ ./test
-1
0
2088773120
0
2088772930
0
2089866642
0
2088803259
0
1896
0
2289608
0
1628013867
0
1896
0
-1
0


Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: amit kumar | last post by:
I am calling a function which returns pointer to a map. The declaration of the map is map<int,vectxyz*>. vectxyz is a vector containing pointer to a class xyz. For map<int,vectxyz*>* p1 In the...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
1
by: Julie May | last post by:
I have 90% of my function working and I know to get the next 10% it is justa matter of getting the quotations and the escaping quotations correct. Here is the portion that does work: <working...
0
by: serkan | last post by:
Guys, I am trying to get this password reset functionality wor for me but I am not successful at all. Please somebody help me. I get "Your password could not be reset - please try again later" so I...
1
by: den2005 | last post by:
Hi everybody, I am confused and still looking why this codes is not working. Can anyone notice or know why this code is not working? Thanks in advance. Code working: <form id="form1"...
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
3
by: shyamg | last post by:
hi all, This javascript is working IE but not working in FIreFox, validating text fields. var dealerid = new keybEdit('abcdefghijklmnopqurstuvwxyz01234567890 ','Alpha-numeric input only.'); ...
10
by: SQACPP | last post by:
Hi, I try to figure out how to use Callback procedure in a C++ form project The following code *work* perfectly on a console project #include "Windows.h" BOOL CALLBACK...
3
by: BibhuAshish | last post by:
Hello guys i have one function which converts the ip/netmask into networkid/netmask and also it shows the message to user that his ip is changed to network id. but that function is working in...
7
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am using this code to get groups for a user and getting a error (5) on the GetAuthorizationGroups() function . There are two domains. This function works on the local domain but does not work...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.