Ok, that makes sense. I'm getting a syntax error where I declare the function though.
Array = GetChar (NumChar, MaxNumChar []);
Type: Posts; User: murjax
Ok, that makes sense. I'm getting a syntax error where I declare the function though.
Array = GetChar (NumChar, MaxNumChar []);
int GetChar (int NumChar, int MaxNumChar [NumChar])
{
printf("Please enter desired characters.\n");
for (int i = 0; i < NumChar; i++)
scanf("%c", &MaxNumChar[i]);
return i;
}
Ok now it works. Thanks.
There are spaces between every item in the file. Here are the contents of the file.
0101 41 8.11 Y 49
0722 32 7.22 N 40
1273 23 5.43 Y 39
2584 14 6.74 N 45
It seems to be. Putting any other value in makes the printf statement print nothing.
That makes sense, except now I have the same problem I had before, printing the first 3 numbers correctly and then printing addresses for everything else.
More trash I see. It seems like it's printing the address of the variable instead of printing the value of the variable. Is it not reading the file properly?
There are 4 lines and no, the return isn't supposed to be part of the loop, which is why I originally had a ; at the end of the last line.
Here's the current piece of code.
void GetFile (int* EmployNum1, int* Dep1, float* PayRte1, char* Exempt1, int* Hours1, int* EmployNum2, int* Dep2, float* PayRte2, char* Exempt2, int* Hours2,...
Removing the ; from the while statement and changing 1 to the number of items being read (20 in this case) doesn't change a thing.
What's the garbage? The contents of the file?
Well here's the thing, it prints the first 3 items, skips the character item after it, and then prints a few random numbers for the 5th item which was supposed to be a 2 integer number.
The data in this program comes from a text file. It seems to read fine but when I try to print it only a portion of the data prints. I think I'm overlooking something but I can't put my eye on it.
...
That was the problem. I thought it was something simple I was forgetting. Thanks.
Hi, I'm a beginner programming and have run into a problem on a project. Here's my loop.
while(scanf("%d", &x) != EOF)
{
a = 1 / x;
b += a;
c = d / b;
d++;