i found this code on the net a while ago. it was originally in c++ but i changed it to c because i had never messed with c++ before. i also added a sort function and a main driver so i could play...
Type: Posts; User: CtrlAltKick
i found this code on the net a while ago. it was originally in c++ but i changed it to c because i had never messed with c++ before. i also added a sort function and a main driver so i could play...
you have defined duplicate as returning int yet you return nothing, so change int to void. also, the for loop within the duplicate function is dereferencing 0 through SIZE of the num array, but...
here's your problem:
printf("X equals %f and %f.\n",&e,&f);
you're passing the address of e and f. you need to pass their values. remove the ampersand.
thanks for the info and the link to the alt malloc. ill have sit down with a cup of coffee and give it a look tomorrow... actually later today. it's 4 am here. i was thinking of allocing large blocks...
i use this function to destroy my tree:
void DestroyTree(splay_t *root)
{
splay_t *tmp;
while(root)
{
from ftp://ftp.idsoftware.com/.
its just the game source, though. they havent released the engine source yet.
hey, hows it going?
i ripped this from the quake 3 source:
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
thanks for the reply.
gxx --version gives me gcc.exe (GCC) 3.1.
heres the code:
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
yeah, kind of slow when compiled with djgpp. just bring it up a notch if using msvc or something else.
you could try this:
#include <stdio.h>
#include <string.h>
#include <time.h>
void warning(char *string, int flash, long speed);
void sleep(long milli);
cant name just one, sorry.
God Lives Underwater - From Your Mouth
PPK - Resurrection
Dirty Vegas - Days Go By(remixed by i dont know)
Masada - All Systems Are Go
Dark UFO - Particle...
id rather use fgets, too, but he already explained why he couldnt. fgets may limit the amout of chars stored in buf but it doesnt limit the amount of text echoed to the screen. :/
in function getTime().
could it be that you free time before you return it?
im not saying he should use that method to save 1000s of numbers into seperate vars. he was asking about pulling tokens from input using fscanf.
here is his original question... again:
hes...
ok, thats pretty much the same thing i posted except i
i used fgets, strtol, and getchar instead of fscanf and getch.
you say you were showing him how to print out the numbers but his post wasnt...
besides, what does yours really do? if he wanted to store the numbers in an array of int, he could do something like this:
#include <stdio.h>
#include <stdlib.h> //for strtol()
#include...
his original question was this:
mine answers that. yours does not. whether your code is more efficient than what i gave him doesnt really matter in this case.
you could try this:
fscanf(file,"%d %*d %d %*d %d", &a, &b, &c);
the * will cause the input field to be skipped and no assignment will be made.
if s1 is less that s2, strcmp will return a negative number. if they are equal, zero is returned. if s1 is greater than s2 strcmp will return a positive number.
try this:
int *getNum(int *numAry)
{
int i;
for(i=0; i<TOT; i++)
p1 = nnn[0] will give you a pointer from int without a cast or differs in levels of blah blah blah warning. it depends on which compiler you use.
nnn[0] is the value stored in that element of the...
ok, first read the line in with fgets.
#include <string.h> //for strlen()
char line[1024];
fgets(line, sizeof(line), stdin);
line[strlen(line) - 1] = '\0'; //removes the '\n'
ok, whats hes done here is use variable formatting (not sure if thats the correct term). basically this line of code:
printf("%.*s\n", len, &rotate[i]);
says print len characters starting at...
clever :)