do you really need to allocate memory for all the pointer though surley thats done when you declare rptr? I dont get why its using the malloc for rptr and why the program works fine when I remove it?
Type: Posts; User: Gav D
do you really need to allocate memory for all the pointer though surley thats done when you declare rptr? I dont get why its using the malloc for rptr and why the program works fine when I remove it?
sorry I know it then terminate the string and the program wouldnt show the left over value form the old variable but would it still be in memory or would that be cleared?
Ive been reading through a tutorial on pointer I found on here and have understood it so far. Im now looking at a sample program that creates a 2 dimensional array at run time. I can understand it...
would the \0 clear the end of the old string?
I wrote a string copy routine for learning purposes and then I dellibratly made it leave the \0 off the destination string and it still works why is this?
char *chrstrcpy(char *des,char...
is it jsut string that are terminated by \0 or are there any other types that use this?
stupid question : if older compilers didnt add the /0 at the end of string for you but the ne wones do what happens if in a new compiler you add the /0 will the compiler add another to the end of...
can anyone tell me why GCC give me '29 : invalid type for argument 1 of get response? Dont ask me why I need the pointer for the structure in getresponse, I do I just havent written the code for it...
GCC has a problem with
int otherfunction(struct *test);
it says error before *. is the * definatly suposed to be there?
Thanks thats what I wanted.
Do I not need to pass a pointer if I wish to edit the contents of the sturcture in the other function?
Thanks I understand now, are there situations when you want to call a function by its pointer then? GCC wasnt giving me any warnings.
I have a structure declared in main and I want this to be avaliable to another function so I assume I need to pass a pointer to the other function ? how is this done.
otherfunction(*ptr);
...
Either that or im skimming over important areas by mistake :)
What does it do when I just call displaymenu? Is displaymenu a pointer and displayermenu() a function call then?
As above what does the -> mean in c?
Can anyone see whats wrong with the following code its not running the displaymenu function its going striahgt over it I think
#include <stdio.h>
int displaymenu ();
int main ()
also sorry to sound stupid but can some explain this
while ( getchar() != '\n' );
is this clearing out the buffer? im guess getchar is taking the contents ofthe input buffer one by one until it...
ok so other than that the concepts look ok? also intFST was initialised just a bit further down
the first 2 scanfs work fine if I enter 4 then 5 it comes out with 4*5 it just doesnt work on the try again one? can you show me in my code what I need to change? other than the scanfs does...
not sure if this answers you question or not but with my compiler I use
gcc prog.c -o outfile.exe
outfile.exe being the name of the file the compiler will create.
ok below is a sample program I used to
multiple 2 numbers the numbers can be
more than 1 digit,. I know its long winded
and the functions are not needed but I was
just trying to get to grips...
ok I rewrote the program and it now works can you just tell me if the following code is how you would have done it? You lot seem to not like the scanf function but getchar was only obviously taking...
OK I understand this now, but I now think all its storing in itst is \n or return as im now getting
' is at 6cffdc"
thanks I have made that change and it now gives the following results...
Enter No. For Variable : 3
51 is at 6cffdc
if I pass 4 into it it give result as 52 and so on. Any ideas?
Taking...