ChandlerI found this site when I searched for a Java RPG to use as an outline since I'm a total beginner in my Computer Science class. I copied and pasted some code that was posted here around two years ago, but I couldn't compile it on BlueJ. Google helped me a lot since I found out how to import stuff...
void display(char * string, int (* transform)(int value))
so i know that transform is a function that is a pointer-to-int and it takes an argument of int value., but what is transform doing? it hasn't been declared until that point and is private to the functions parameter scope. i'm not one for the "black box theory". i like to know what's in the box.
string[i] == *(string + i) == string == &string[i]
are all supposed to be synonymous. which is why you can say that
string[i] = toupper(string[i]); == *s = transform(*s) || *s = toupper(*s++)
assuming were using a while() loop for instance
while (*string)
ChandlerI may seem like an idiot for asking, but here's something I made on BlueJ that I need help with: /** * class Kirby will draw a Kirby character * I'm disclaiming now if that's an issue * * @version WhenChandlerThoughtItWouldBeMoreEfficientToUseMicrosoftPaintForThis */ //At the bottom of t...
string is the address of where the data is stored.
[0] is the dereferenced value, or where the first element is stored at the given address.
string[0] is assigned the value that toupper returns which is an assumed char, or int value that represents a char value. string[0] is the char that is processed by toupper and toupper returns an "uppercase" value, which is really...i see now lol.
hedfun2I am new to encryption and recently wanted to learn more about it. I researched how to do AES Encryption in java and assembled my own java AES encrpytion class. I don't know if there are any major security holes though. Can someone experienced in java encryption look at my code and tell me if the...
so if we had the string "hello, world"
and broke it down, it would be an array of chars with a terminating null char '0円'
i is in the scope of the for loop and only exists until the end of the block.
for i is initialized to 0 while string char is not null increment i postfix
assign string[i] the value of passthrough(string[i]);
which basically checks to see if the passed value is an int and if it is it returns an int which is passed to string[i].
while each value is passed over to pass through, it needs to be of type int. the data object being passed to the function. im assuming, or inferring, that since only an int value can be passed (thats part of the test, or condition) and if it does so, it can return the integer based value to the calling function or object.
and transform = toupper;
i had expected some arguments such as var = transform(value);
rolflI have coded up in SEDE what I believe to be a mostly accurate representation of the post edits that count toward Archaeologist. It identifies all your edits, and then discards those that were active within 6 months prior to the edit. It uses the following strategy to determine the last activity...
With that knowledge, let's look again at
void display(char *string, int (*transform)(int))
{
for (char *s = string; *s; s++)
{
*s = transform(*s);
}
puts(string);
}
--------------------------------
alright, lets go back for a sec then, so i can better understand
lets say these are both functions
function one and function two respectively
int * function_one(int)
int (*function_two)(int)
both are functions, but the important part here is the precedence
one says im returning a pointer to an int
and the other says what again?
gabrielfreibergI have an angular app using a restful api which works, but I know is structured poorly. I'm using a projectService (factory) to do all interfacing with the REST back-end, for both of the backend Project and Task models. The ProjectController and TaskController both get the projectService (fact...
transform = toupper
since transform is not a function and it is a pointer to a function, you can point to an already existing function such as toupper, or tolower, or to transform...
were really saying, transform is pointing to an existing function that can do this behavior for us already, so let toupper do all the work. toupper is passed the value by using transform which is also a pointer. so we can arbitrarily use one function or task over the other depending on the needs of the current action.