the function, max, needs to be an int.
do not put 'int' in the arguments when you call the function.
the function, max, needs to be an int.
do not put 'int' in the arguments when you call the function.
void max(...
has no return type (it's void) but you're trying to return integers. and yet, you have the function attempting to assign a value to a long integer. why long? change it to int, and change the return type of max to int.
hi, that's a very nice cut-and-paste you've done.
did you use the mouse right-click to paste? or did you use CTRL-C and CTRL-V? i prefer using the keyboard myself, it seems much more efficient.
Hard time using a search engine?
come on, man. that's a legitimate question to ask.
i agree that "void main" is to be avoided, but merely calling it "the evil" without explaining why is not going to impress many newbies, since it will always appear to them to work.
Anyhow, while "void main" may blow up a program in some future event, "scanf" will likely blow up a program here and now.
you should not advise beginners to use "scanf()" -- there's far too many pitfalls and unexpected behavior with that function. it's like using a chainsaw with no safety guards.
use "fgets()" instead.
Yehey! I won! I won!
i don't think so.
what's "the logic"? FEC is a strategy not a protocol. there are a number of algorithms that could be used.
learn to formulate a proper question, and post it in the proper forum.
the main() program can often be called by a parent program. 'return 0;' indicates to the caller (parent) that the main() program executed correctly.
so... generally speaking, the main function must be of type 'int' and therefore must return some integer value on completion. zero (0) is the standard "successful" return value (think: returned with zero errors) although it could be some other value that indicates an error state, depending on the caller
if main does not return a value (like the case of 'void main()' ) then you are now in the realm of "undefined behavior" when the program is called by another. Undefined behavior is almost always a Bad Thing.
.
i second that ^ :$
Salem gave him (+) that far outweighed any (-) you and i gave.
alberton, generally speaking you can't just go and grab some missing header file off the interwebs and expect it to work. these types of headers are often built for your system, and even if you got a header file to work, you'd likely find yourself in an sequential procession of one missing header file after another.
so.. what Nick and Wildgoose said. go build (or rebuild) the development environment source files correctly.
you dont know what what means? casting? start from the beginning of Tom Gunns code snippet:
'd' is a double (floating point) variable containing 23.4.
'w' is a double variable set to the value of 'd' once 'd' is casted as an integer. (see where 'd' is casted as an integer by the use of 'int' type in parentheses.) now 'w' contains the whole value 23.0 with no fractional part.
'p' is another double variable that is the value of the difference between 'd' and 'w'... since 'd' is 23.4 and 'w' is 23.0, the difference is 0.4, and this fractional part is assigned to 'p'
now 'd' still contains the original decimal value (23.4), and 'w' contains the whole number (23) and 'p' contains the fractional part (0.4)
.
lets look at the program you have modified and get rid of some obvious errors.
(1) you dont have a "compile error". the program you posted (the second one) compiles without any error even though it may have other flaws. what you have is a runtime condition ... if (argc != 3)
... that determined you didnt pass the required arguments, so it exited with an explanation why.
If i compile the program like so:gcc -o taiko taiko.c
then call it like so./taiko
it will correctly exit with the warning that i did not provide the correct number of arguments.
so you must call it, for instance, like:./takio <arg1> <arg2>
where <arg1>
and <arg2>
are values you (the user) provides that will be swapped, divded, etc.
(2) you have an "int swapargs( )"
function embedded within the "void swapargs( )"
function. i do not imagine this is correct. i assume you should only have a single function, "void swapargs( )"
part of the problem here is your complete lack of indentation, for blocks of code within the curly braces. maybe you had it at one point and lost it when you posted here. without indentation of code blocks, its very easy to make typos.
here is repost your code with the "void swaparg ( )"
function fixed, and indentations and syntax coloring so we can at least see it better. you can use the code tags to frame your code, and indent your code with …
must not be too urgent.
you havent given us anything to review.
to post in this thread, wins.
what part of "Just subtract the two pointers as shown in the code [Dragon] posted" are you still confused about?
The game is just like Tetris, only there are no blocks, instead we are matching them to trash bins.
the individual words, I understand.
the sentence, makes my brain hurt.
well.... could it be that you pretty much killed his thread with your disturbing spelling game? .... just sayin', because i didn't really want that visual of you acting out your cunnilingus fantasy on a plate of jello.
oh, i'm sorry. was that too much information? :-O
.
Once we stay here for as long as Narue or you then we too would feel the same.
um, i appreciate the gesture, but i must decline to be compared as somehow equal to Narue in any measure: i'm still a noob here.
well, i'm no microsoft fanboi, and i hate Vista as much as the next guy (I'm using a linux distro as i type), and i do get the point you're trying to make...
... but i seriously doubt that any of microsoft's myriad of problems have to do with void main()
i think these posts ought to be instantly deleted by moderators, along with a copy of a standard explanation auto-delivered to the poster's email.
I can see why Narue has all but left daniweb ... because it's this kind of non-stop crap just makes me want to flame the hell out of people who post it. I don't even want to waste my time trying to explain why they won't get help.
.
it had better not be more than US$10,000.
that would be 100 bills. don't need a suitcase, you could stick that in an envelope.
Put me down for 10 bucks on : wrong :icon_cool:
you're on.
just kiddin. serkan's aaight. i just like to mess with him. :P
OMG
Serkan wants your pictures!
Dont Do It!!!
:eek:
.
i still think he's Narue's alter ego.
Well, I don't know whether I'm allowed to ask this, but why don't you mods, just do an IP-check on both accounts?
YoU aRe NoT aLLoWeD tO aSk ThAt QuEsTiOn!!!!1
if you think Ministry is pop metal, then ... yeah.
are you calling shenanigans on my shenanigans?
I had two yrs of Behavioural and Moral philosophy under this guy ... blah blah blah [snip]
thanks for proving my point
:icon_rolleyes:
@ JBennett ... you should read
Hegemony or Survival: America's Quest for Global Dominance
by Noam Chomsky
Look on the bright side -- you didn't get banned did you?
well, yeahhh..... I mean, we're talking about Serkan
:P
Why? Just because i'm unhappy with Vista, that's why
fixed it for you.
people don't toss out a perfectly good, current, and stable OS for something relatively unknown and stripped down with less features than the original --- unless they have a reason
.
I deleted that poll and thread because we don't flame/attack other members. I don't care if serkan did approve of it -- flaming by any other name is still flaming.
damn, i put a lot of creative effort into that poll. :(
Curious bunches thrive on rumor more than blunt truth. ;)
well, ain't that the truth
:icon_cheesygrin:
So i am not as creepy as an average scientologist.
The institution and tenets of Scientology is certainly a really weird thing. But just looking at the average individuals, the Scientologists ... you're way creepier.
Look, I've known a number of Scientologists. there were a bunch of them at one place i worked, years ago. Are they "deluded fools?" ... Yes, every single one of them. Are they "creepy?" ... Not especially. You've got them all beat hands down.
Do you want to know why?
because people can tell religious nuts to go away and they will leave, or at least shut up. But you, you just keep coming, with your duct tape and your rope and your chloroform, and you
Just.
Don't.
Stop.
.
Scientology is creepy as it's a goony bird cult that has fucked up tens of thousands of people.
Serkan doesnt have that kind of influence, but he is creepy on an individual personal level.
since none of us here (I imagine) are gullible enough to buy Lord Xenu's Magical Thetan Removing Elixir, Serkan has more immediate power to revolt.
I, for one, can imagine this guy from Kazakhstan driving an ice cream truck across country while wearing adult diapers, with a box full of rope and duct tape to chase down some woman he saw a picture of on the internet to profess his marriage intentions to her.
by the numbers, he cant compete with Scientology. But at a real personal level, Serkan is definitely more creepy than the average Scientologist.
also think about scientology, am i more creepy than that?
well.........................
no.
i really want to meet her in real life. as i said before, many girls see micheal jackson on stage and they go and cry and hug him. why cant i do the same thing with Narue?
Tell me this in logical terms.
you are scary.
and i don't mean this as a joke, or as a witty insult.
i mean you are truly scary -- in a duct-tape, kitchen knife, chloroform, spool of clothesline, and wearing an adult diaper across state lines sort of way.
i will miss her a lot...
i wouldn't be surprised if she left due, in some part, to creepy stalkers.
>> Market capitalism: unsustainable. Do you agree?
Fallacy of the False Dilemma.
presumes a universally agreed-upon definition of "market capitalism" which is so tight in scope that it can be reduced to an either/or premise.
you failed. step down, kiddo.
you suck, because you haven't updated your signature with a new Jack Handey quote.
First I get attacked for not being perfect right out of the gate. Now I get attacked for fitting in. What do you want from me? :confused:
lol, i'm not attacking you. if anything, i'm commenting on your awesomeness.
i just find it curious that you popped into existence some 29 days ago and been kicking ass like nobody's business .... coincidentally at the exact same time that a certain someone else ceased posting.
now who was it that used to post quite regularly, right up until their disappearance about ... oh, 29 days ago?
do you see where i'm going :)
Forums ain't exactly the bleeding edge of teh intertubes.
of course not, but each forum has its own culture and character that invariably takes some time to figure out and fit into.
Tom Gunn's performance here has been pretty remarkable. You'd think it would take a bit more than 28 days before someone finds themselves eligible to run for Crown Prince of the C/C++ forums.
did i say 28 days?
am i going anywhere with this?
.
the error is probably due to the fact that 'x' isn't initialized, so it's value is something like negative eleventy thousand, causing your program to crap the bed when it uses it as one of the array indices.