All variables should be initialised when you decalare them.
ie int i = 0;
i will be changed later in your code but this would initialise the variable and keep your compiler happy :-)...
User Profile
Collapse
-
desperate help needed! java.util.Scanner weird error.
Hi.. Im experiencing a weird error I dont know how to fix. I have a scanner object and whenever I use nextInt, anything above 3 causes the program to crash saying and links me to this line of the class: (one I added all the asteriss to.
// If we are at the end of input then NoSuchElement;
// If there is still input left then InputMismatch
private void throwFor() {
skipped = false;
... -
Why is this? JUst wondering if you could explain it s I understand what I am doing wrong....Leave a comment:
-
-
btw this code worked for another site.. but for some reason not this one. Can anyone tell me what Im doing wrong?!Leave a comment:
-
form mandatory fields
Ive been looking through a whole tonne of sites to try to find out how I can make my fields mandatory but havnt been able to find something so far which actually tells me whwta I want to know. Ive tried a couple of code segments but they havnt been working. can anyone tell me how I can make fields in my code mandatory?
My attempt at solving this is below:
...Code:<html> <head> <title>Coals
-
-
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?...Leave a comment:
-
passing data in C without returning.
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. -
"Access Violation with segmentation errors"!
Hi,
I have just spent many hours debugging my code and now when I run it I get the following error:
"An access violation (Segmentation fault) raised in your program"
I have researched on this and found that it is usually the result of faulty pointers or memory that is not allocated. However I have allocated all of my memory corectly (I feel) and my pointers look to be correct.. Is there another reason... -
dw, i have managed to fix all of these errors. Thankyou to all of you who assisted me with this.Leave a comment:
-
Im getting these errors now on compile. It compiles with no problems in C++ but needs to be in C.. I honestly cant see anything wrong in any of these and is everything I have been taught in C.
43 syntax error before '&' token
45 syntax error before '&' token
46 syntax error before '&' token
96 syntax error before '&' token
In function `readMatrix':
99 `fp' undeclared (first...Leave a comment:
-
the program doesnt even prompt the user for the file name though.. Ill give it a try and c what I can do. Thanks heaps.Leave a comment:
-
btw i think my compiler is compiling my code as C++. That may help some?Leave a comment:
-
I am running a debugger but it int stopping at anything just coming up with an error.. I suppose I ould put printf s everywhere and try it that way but it is very time consuming.
Can you tell me more about why NULL would cause a segmentation violation? we were told to use it....Leave a comment:
-
it also points to this in <stdio.h>:
"{ return __F->_flag & _IOEOF; }"
I dont understand what this means, im hoping one of you does..Leave a comment:
-
C runtime errors. desperately needing help.
my program compiles without problems but when i try to run it pauses shortly and then crashes. When i set it to debug it came up with the following message:
"An Access Violation (Segmentation Fault) raised in your program."
Ill put my code below. can anyone see why it is doing this?
[code=c]
/* Program Function: Reads in data on a boolean matrix (/s) and outputs
* whether... -
Problem Fixed!!!!!
For some reason I had to typecast calloc to an int. I think it may have been compiling as a C++ file :-S. I just read in a guide on the net that you should always typecast it even in C.
Solution was (for those who are curious):
andCode:*matrixPointer = (int *)calloc(rows, sizeof(int *));
...Code:*matrixPointer[index1] = (int)calloc(columns,
Leave a comment:
-
im still trudging away with the code.. after the changes now I am getting a very similar message for the same code sections.
invalid conversion from void* to int*
I still dont understand..Leave a comment:
-
Thanks, I feel that I am getting closer to a solution. I copied and pasted this into my code but still no banana. it wouldnt compile saying that there was too many arguments for calloc. could you please put fill in a bit more on the syntax and Ill try it again? are there supposed to be commas somewhere in the calloc parametres (like: "*matrixPoi nter = calloc(rows, * sizeof(int));") ?
my code as it stands now is:
...Leave a comment:
No activity results to display
Show More
Leave a comment: