15,552 Topics
| |
Came across a code that's working but cannot figure out why #include<stdio.h> #include<stdarg.h> void fun(char *msg, ...); int main() { fun("ABCDEFG", 1, 4, 7, 11, 0); return 0; } void fun(char *msg, ...) { va_list ptr; int num; va_start(ptr, msg); num = va_arg(ptr, int); num = va_arg(ptr, int); printf("%d", num); … | |
Hello, Everything in code when well there is a small problem on display output: when I run the file this is the output i got 69 6E 74 20 6D 61 69 6E 20 28 29 20 7B 7D 0A my teacher have 0000 : 69 6E 74 20 6D … | |
ABC Bank gives loans to its customers at a monthly interest rate of 0.75%, and recipients are expected to make fixed payments every month. The bank uses the formula below to keep track of the remaining balance recipients owe after each monthly payment. where: Balk = balance remaining after the … | |
I have a 1000x24 matrix in a text file and i want to sum the adjoining columns of the whole matrix e.g. col1+col2, col2+col3, col3+col4,... col23+col24 and store these values in a separate text file. My code runs like this: #include <stdio.h> int main() { int i,j; float a[100][24]; FILE … | |
I need some ideas on my array of struct implementation. This is what I have in my structs. I plan on making SHAPES an array because I will have multiple SHAPES. Each shape will have multiple x and y coordinates. Because of this I'm not sure if should make a … | |
Hi all, I have a problem where i need to find to what library my code links to. Here is the scenario: a) I have two executables. Both link to pthread. But pthread seems to behave differently. b) I am not sure that they are linking to the same version … | |
I'm using the following swap function to swap two elements of an array. The element pointed to by 'x' and 'y' and the one right below it, to be particular (then i want x and y to point to the second of the swapped elements, hence i use auto increment). … | |
Hi guys!, I have a code here having a problem about double and I'm kinda lost so I don't know what to do. btw thanks for reading my thread, I would greatly appreciate if you can help me fix this thing. #include <stdio.h> #include <conio.h> #include <string.h> #include <stdbool.h> #define … | |
Hi, I'm facing some problem while returning string. I want to return final string value and print it. Below is the code that i tried, int main() { int Input = 0; //Tried using tmpstr also //char *tmpStr = NULL; scanf_s("%d", &Input); //Tried as below also but it was crashing … | |
Hi! Few days ago, I had learned C language. It took me almost 8 to 10 months to learn the whole language. Now I wanna want to make real world applications using it. I'm an Ubuntu user or more generally a Linux user. The point to ponder is that I … | |
I'm trying to make a calendar out of C. I need it to be able to promt the user for a month, and the year, and it should then print the calendar of that. So far the code I've got is: #include<stdio.h> int days_in_month[]= {0,31,28,31,30,31,30,31,31,30,31,30,31}; char *months[]= { " ", … | |
1.Input three unique numbers and print the different of the highest and lowest numbers. 2.Input three integers a determine if there are equal numbers . If There are equal numbers, print the product of the equal numbers, Otherwise print the average of the numbers. 3.input three unique numbers and average … | |
Just started learning about buffer overflow attacks and had a question regarding something in this https://www.youtube.com/watch?v=EcMCiFwHnjE/ video. Why does the person write `jmpesp()` function (~1:38)? The function is never called anywhere in main so how does it appear on the `objdump` (~3:15)? Also, what is the point of the `jmp … | |
Any Turbo C programmer out there that are capable of doing this for me :D I cant figure this out :D thank you and God Bless :D | |
I dont know how to program in Turbo C, My brother need a Hexadecimal Converter that's programmed in Turbo C ( Hex to Bin Hex to Oct Hex to Dec? ) | |
I dont know how to program in Turbo C, My brother need a Hexadecimal Converter that's programmed in Turbo C Hexadecimal to Binary Hexadecimal to Oct Hexadecimal to Decimal ) Thank you for your help :D Good Bless!! | |
I'm having problems with this program. Everytime i enter a fractional decimal number, it displays -0.0000 or sometimes garbage values. Ex: Enter any fractional decimal number: 5.7 -2.888blah blah blah garbage another Ex: Enter any fractional decimal number: 25.7 -0.000000 #include<stdio.h> int main(){ long double fraDecimal,fraBinary,bFractional = 0.0,dFractional,fraFactor=0.1; long int … | |
Alright so I am getting a weird problem with the following code int toDB[2]; int fromDB[2]; char * param1; char * param2; err = pipe(toDB); if(err==-1) { printf("Error on pipe creation: %d\n", errno); exit(1); } sprintf(param1, "%d", toDB[0]); err = pipe(fromDB); if(err==-1) { printf("Error on pipe creation: %d\n", errno); exit(1); … | |
quick question how can I work around this char * dat = "08/11/2014"; char test[10] = dat; I need to be able to take a string and put it into an array of chars, how can i do this? | |
How do I use pipes to communicate with another proccess that is being run using an execl command? I know how I can send info to that process but how do I get info back from that proccess? Some more information on what Im trying to do: I am trying … | |
Hello, i'm new to C and i have no idea why i'm constantly getting 2293532 as the output value of %d. Any help is appreciated, thanks! #include <stdio.h> #include <stdlib.h> int main(void) { int friends; printf("How many friends do you have? \n"); scanf(" %d", &friends); printf("You have %d friend%s", &friends, … | |
Hello , why am I taking : > > *** glibc detected *** ./run: double free or corruption (out) #include <stdio.h> #include <stdlib.h> void func1(int **A ) { *A = (int*) malloc( 2 * sizeof(int)); for (int i = 0; i < 10; i++){ (*A)[ i ] = i; //printf("\nA … | |
here my script, please help me to resolve it :D thanks #include<stdio.h> #include<stdlib.h> #include<string.h> #include<float.h> int main() { /* KAMUS */ /* volume gas ideal = V=nRT/P -R= 8.314 P: tekanan (Pa/ N/m^2) = 8.5 V: volume ruang (m^3) n: jumlah mol gas (kmol) = 1.5 R: tetapan umum gas … | |
Hello every one Can I have a better algorithm to find the nth prime number, where 1<= n <=5000000. for e.g., 1st prime number is 2. 10th prime number is 29. 100th prime number is 541. 1000th prime number is 7919. 10000th prime number is 104729. 100000th prime number is … | |
Maths Homework Input : Standard Input Output : Standard Output Time Limit : 2 sec Bob had got a ton of homework for the weekend that he has no time to verify whether he is getting right answers or not.So he decides to write a computer program for this as … | |
a program to count the number of occurrences of words in a passage. The program will read white-space separated words from a file, convert all words to a single case, and remove any non-alphanumeric characters from both ends of the words. It is to count the number of each word, … | |
hi i need help with my class assignment we're suppose to create a 4*5 grid, two player and three enemies. the grid is made up of coordinates and i am not allowed to use arrays. To start the game the players must enter their names and then go to (0,0). … | |
I'm almost giving up on this problem. How to convert an integer to it's hexadecimal equivalent. I'm not looking to printout the hexadecimal equivalent of the integer in printf() but for a hexadecimal number. | |
I was just thinking that why I need headers at all? In headers, most oftenly we have the declarations only. In .cpp we have the definitons of that .h file. But, why can't we write all the functions directly in .h file and include it in my project files? Why … | |
Here is what i got so far. I got stuck at white-space separated words from a file, convert all words to a single case, and remove any non-alphanumeric characters from both ends of the words. It is to count the number of each word, and then write to a file … |
The End.