[Solved] Why my function doesn’t work?

Your exponent function needs to return the n instead of x and in your main() you probably want to initialize the variable x to the value of function exponent with an argument of 5: int x = exponent(5); prior to printing via: print_exponent(x); That being said, your exponent function is broken as the return value … Read more

[Solved] nested calls to printf [duplicate]

You may be able to see what’s happening more clearly if you split the statement into several statements: int temp1 = printf(“Hello world!\n”); int temp2 = printf(“%d”, temp1); printf(“%d”, temp2); The first printf prints Hello world!\n. Since this is 13 characters, it returns 13. The second printf prints 13. Since this is 2 characters, it … Read more

[Solved] Positive and negative number values [duplicate]

One way would be to just add a negative sign in front of the value: int myInt = -myInt; Another way to switch between a positive or negative number in a statement would be to multiply it by -1. myInt = myInt * -1; 0 solved Positive and negative number values [duplicate]

[Solved] If/Else Statements in C are not working

This: if(fare == -40){ char desc[50] = “Ouch! Cold either way!!”; } opens up a new scope, with a new local variable called desc, that “shadows” the one in the surrounding scope. This variable is initialized to the string, then thrown away as the scope exits. The variable of the same name in the parent … Read more

[Solved] CreateThread() does not work [closed]

You didn’t post any minimal compiling code we can help you debug, so, everything I’m about to say are guesses based on other questions I’ve seen on this topic: make sure asd is declared static, CreateThread is a C function and knows nothing about class methods make sure asd is declared __stdcall, having wrong calling … Read more

[Solved] Convert double * to double [9] in C [closed]

#include <stdio.h> #include <string.h> typedef struct dbl9 { double array[9]; } Dbl9; Dbl9 fun(double *in){ Dbl9 ret; memcpy(ret.array, in, sizeof(ret.array));//There can be no assurance that <in> the correct return ret; } int main(){ double array[9] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0}; Dbl9 dbl9= fun(array); int i; for(i=0;i<9;++i){ printf(“%f\n”, dbl9.array[i]); } return … Read more

[Solved] using Gps Getting Latitude and Longitude

http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/ Go to this link to get your location You can implement a loop with postdelay handler to implement 5 minute refresh rate and run the getLocation inside that… Use SharedPreferenceManager to store the last known lat and long to the sdcard data https://mongskiewl.wordpress.com/2013/10/16/sending-json-data-from-android-to-a-php-script/ Follow this to send JSON data 🙂 4 solved using Gps … Read more

[Solved] Explain what the function does [closed]

It hooks the submit event on all forms that exist as of when that code runs and, when the event occurs, prevents the default action (submitting the form) and instead dumps out the form contents to the web console. Details: // v— 1 vvv–2 v—- 3 $( “form” ).on(“submit”, function( event ) { // ^^^^^^–4 … Read more

[Solved] Find the longest string

We can do this in two lines of code: List<String> list = Arrays.asList(letterlist); String longest = Arrays.stream(letterlist).max(Comparator.comparingInt(String::length)).get(); Demo Inspired by this Code Review question: https://codereview.stackexchange.com/questions/75807/finding-the-longest-string-and-its-length-using-java-streams 0 solved Find the longest string

[Solved] What will be the output in C? [duplicate]

Warning, long winded answer ahead. Edited to reference the C standard and to be clearer and more concise with respect to the question being asked. The correct answer for why you have 32 has been given a few times. Explaining the math using modular arithmetic is completely correct but might make it a little harder … Read more