post the part of the code where you are having trouble.
I think using fgets and sscanf should be able to get most of the data into the appropriate places. using strtok and having a special character...
Type: Posts; User: tzuchan
post the part of the code where you are having trouble.
I think using fgets and sscanf should be able to get most of the data into the appropriate places. using strtok and having a special character...
ah, the good old returning pointers stuff...
first of, refrain from returning pointers... BAD move, cause if you are returning a pointer to an inside variable, the data will be gone before you can...
if that's the case, write a program that does this:
if(temp == EOF)
printf("%c", temp);
and then start hitting that keyboard of yours with as many ctrl combinations until you hit the EOF...
...
char *string_replace (char *s, char c, char r) {
char *p1;
for (p1=s; *p1; p1++) {
if (*p1 == 'c'){ // <---- Error here
*p1 == 'r';} // <---- And here...
...
Okay. Didn't bother coding it into a compiler and seeing what's going on, but basically, I think it returns the number of first n characters in string s that exist in string t.
first of all, passing...
actually, no.
the if(n) is acutally checking to see whether your n is pointing to a NULL or not.
if it is pointing to a NULL (which is commonly defined as 0), the if statment becomes false and...
try adding this line beneath every occurance of scanf
while((temp = getchar) != EOF && temp != '\n'); // <--- must have semicolon
This should clean out the input buffer.
Err... I'm not too sure that's possible?
Normally, when we play with characters in console, we are using the ascii character set...
now, without the windows.h header file, I'm not aware of any way...
assuming you are directly cut and paste, here's an error
if((ques !='y)' || (ques !='Y'))
also, ques != 'y' || ques != 'Y' will give you true no matter what you enter...
if ques == 'y', then ques...
...That's not not having to include all the header files you use, that's just putting it in another file...
And as to the one to one ratio of header and source files, that honestly up to personal...
umm... with regards to your mention of what size_t is, it's actually a unsigned long int or unsigned int, depending on your compiler IIRC...
Also, a bit of clarification regarding the .c and .cpp...
first off, ? exists in C, second off, changing that still doesn't make that macro make sense...
Essentially, macros are a shortcut for replacing certain types of things in the code when you...
/shrugs
Actually, that depends on what he's trying to do...
if he's doing the == comparison, then it's risky, very much so...
but if he uses the fabs() function with it, such types of comparisons...
Okay, I'm not going to go through this file by file because apparently the major problem is that you don't quite know how to include separate files yet...
First major problem:
The file that...
Hmm... Don't have much experience with console based compilers, and can't look through your source codes to see if there's any errors...
could you post the #include part of all your header files...
First of all, check and make sure that your function files include thier respective header at the top.
Eg: header file name == myfuncs.h
in file containing the code of the functions, at the top,...
Essentially, when you loop and run the scanf to num, you clear out anything that was originally stored in the num variable... that includes the sum of previous data(not that it actually sums it...
I spotted some thing that doesn't seem right...
int usedcharacters (char usedchars [], char let2bg)
{
int k;
for(k = 0; usedchars[k] != '\0' && usedchars[k] != let2bg; k++);
...
The good news is, you almost got it working.
The bad news?
You didn't store the char value that the function return.
In order to store a value that a function returns using the return, you have...
As long as you pass in the usedchars array from the main function and you initialize it as
usedchars[maxnumofguess+1] = "";
the usedchars array will become your store of which characters have been...
least complex but more coding way?
create another function similar to your minimum function, but return the index of the minimum value instead.
Any other method would atleast require pointers if...
if (let2bg = usedchars[k])
That should have been
if (let2bg == usedchars[k])
it's one of the easier to make programming errors...
Also, you can try initializing the array with '*'s or ' 's so...
if(fwrite(&people[n], sizeof(CONTACT), n, fp)!=1)
The error is in this line.
first of all, a bit of explanation about the fwrite function.
First of all, let me state that fwrite is IMHO...
actually that was a program to test and see if I can make the program automatically treat the union as one of the members without having to specifically calling the member.
essentially, what I was...
in the order of your questions starting from do you need a for loop
yes, it's good programming practise to do so, *shrugs* could be anything, depending on how you want to use it, you should stop...