Ok I have some things to think about, thanks for the replies.
I've started using gdb to debug, I've never done it before and it's very interesting.
Type: Posts; User: hellogamesmaste
Ok I have some things to think about, thanks for the replies.
I've started using gdb to debug, I've never done it before and it's very interesting.
I have a text file with ManchesterUtd01Reading, I open it for reading, count the number of characters on the first line and use it in a loop, the loop will insert a single character in an array...
lol oops
Dealing with files seems pretty awkward and complicated to me and also inconsistent in the results.
With the following code:
#include <stdio.h>
#include <string.h>
int main()
With your incorrect code above is it trying to store an int value as a pointer address? So instead of pointing to a memory address location, it's trying to point to a integer as a memory address...
Ah I thought so.
One thing I don't get with my program here is newNode->strname,name), in that usually you do *name to get the value of what the pointer points at.
So usually you do:
int a;...
Lol I could have just done strcpy(newNode->strname,name); and that is it.
In a tutorial they use strcopy, is that a typo on strcpy or something else?
I got it working finally. I remembered that when you pass an address to an array it only looks at array 0, so you have to step through it using a loop to read and write each character.
int i;...
I read a 26 page explanation online about linked lists from Stanford university, actually I read it about 100 times and I understood it in the end.
So I copied the code and got it working fine....
I'm just learning the basics of C at the moment, currently trying to understand linked lists and programming one, then I'll move on to file input/output after a while.
I just wonder if it is ok...
I am learning C as a hobby and it looks like the goal of beginner tutorials is to create simple applications, which is fine to understand how the language works.
However, C is supposedly mainly...
Ahh thank you. That has made it clearer. I just hope it sticks :)
I ask because my program didn't work and I didn't know why.
In [1] I had:
int qcheck(int , int *p);
in [3] I had:
I am not 100% sure about functions at the moment.
[1] Declare function above main.
int qcheck(int holdans, int *p);
[2] Call function:
Ah simple. Thank you.
Ok I've already spent hours agonising of why my program didn't work and it turned out Switch should have been switch, but the error message "should have ; before {" was not very helpful.
Anyway...
Is it true then, that whenever your pointer points to a structure address, it does not point to all the components, so you have to use & for age as if it was just a normal variable? otherwise if you...
I have modified some tutorial code to get input from the keyboard, and then call a function with a pointer to a structure as input.
I have got it working but I don't understand why the first time...
I'm just starting out and have an idea in mind to create a quiz program, not sure how to implement it yet because I don't understand how it would work. Also not sure if I'd have to use structures...
So what is the proper way to do 10/3 to get a decimal result?
Is it to store 10 and 3 as floats or is it to use the casting method: a = (float) 10/3?
C - The float and double Data Types and the...
Hi,
Why can you put integer values into a float variable and there is no error? maybe I am confused about float ranges but I thought it only contained decimals.
I had two integers, 10 and 3,...