15,552 Topics
| |
I cant get my intended result I want my program to display can anyone help me. The program is to print the workers name who are listed in the struct and if you don't enter any of those names I should print worker name doesn't exist. Can someone tell me … | |
I have to create function that reads the binary file of futball matches and shows the legue table. The table should contains, for each team, the name of the team, number of points, goals scored and goals conceded. Give 3 points for a win and 1 for a draw. The … | |
Im trying to implement queue with a linked list i think i have the enqueue function correct but im having problems with the dequeue. I can get it to delete the first number but then the rest of the list is empty can someone point me in the right direction? … | |
I have these files.. **str.h** #ifndef _str_h_ #define _str_h_ struct STRSTR { char* MainStr; char* SubStr; }; char* str_str(int, int, struct STRSTR* sample); void init(char*, struct STRSTR* sample); #endif /* _str_h_ */ **str.c** #include "str.h" #include <stdio.h> void init(char* str, struct STRSTR* sample){ sample->MainStr = str; } char* str_str(int index, … | |
Hello, i was wondering if i could get an opinion on the following code as it is giving me a headache: int counter = 498853097; int k = 0; clock_t start, end; float seconds1,seconds2; start = clock(); for (int i = 0; i < counter; i++) { k++; } end … | |
Please can someone help me and show me where i am going wrong ? The code below is not an assignment or homework it is something i am tryigng to do for work. The code scans a text file ( attached ) and stores 10 x 5 digit ints into … | |
I am creating a doubly linked list and printing a backwards function. Everything is working great in my code, but when the function is printed in reverse, I need it to say NULL at the end, as it does going forward. When I put puts("NULL") (line 193) it splits up … | |
How to concat multiple strings in C? I have a function for concat two strings: char* concat(char *s1, char *s2) { char *r, *t; int d1 = -1, d2 = -1; while (s1[++d1]); while (s2[++d2]); t = r = (char *)calloc(d1 + d2 + 1, sizeof(char)); while (*t++ = *s1++); … | |
I have come across one question: find the size of two 2-D arrays when double pointers are given for them.Then find, if we can muliply these two matrices(those mathematics rules). finally we have to multiply the matrices. I have asked this question(small part of this question) earlier also. someone answered … | |
**Problems 1: Spiral matrix - Advanced** Source of the problem: [Here (not in English)](http://www.spoj.com/PTIT/problems/BCACM11B/) Spiral matrix is formed by filling number 1 in 1st row 1st column, after that, filling with increasing number by clockwise, example: 1 2 3 4 5 16 17 18 19 6 15 24 25 20 … | |
I am having a confusing time with understanding arrays and variables because of this reasoning: Variables are aliases for memory locations and array name is the address of the first element of the array then why are variables not accesssed as *i whereas the first element of array is accessed … | |
I came across this code of [firefly algorithm](http://en.wikipedia.org/wiki/Firefly_algorithm) and need to use it in my major. If any of you could explain the working of the functions, it would be of great help to me. Thanks in advance. #include<iostream> #include<stdio.h> #include<stdlib.h> #include<math.h> #include<time.h> #include<string.h> #include<memory.h> #defineDUMP 1 #defineMAX_FFA 1000 #defineMAX_D … | |
Hello, I am trying to compare a double to be within various ranges, but the comparison is not working correctly. Rounding precision is not a concern, because if the value will match the boundaries so rarely, and it is rounding up to the higher range is acceptable. Below is the … | |
Here is the code for [B][COLOR="Red"]Insertion Sort, Bubble Sort and Selection Sort[/COLOR][/B] [B]Insertion Sort[/B] [CODE] #include <stdio.h> main() { int i,j,key; int a[5]={5,2,3,4,1}; for(i=1;i<5;i++) { key=a[i]; while(i>0 && a[i-1]>key) { j=a[i]; a[i]=a[i-1]; a[i-1]=j; --i; } } int k; for(k=0;k<5;k++) {printf("%d ", a[k]);} printf("\n"); } [/CODE] [B]Bubble Sort[/B] [CODE] #include <stdio.h> … | |
hi everyone , i have worked on this 2 days now and cant find my mistakes , the program runs but it stops ( waiting ) after i enter 3 or 4 . can anyone help me where are my mistakes please? thanks allot. the program should do the following … | |
I have a C code written in Visual C++ 2010 environment and it compiles without errors. When I try to debug it, after the line with scanf() function it goes to unknown scope and stops the process of debugging. How to fix this? Thanks for replies. | |
Which tool for code analysis is the best for complex C programs? I use GCC debugger with Code Blocks 13.12 Thanks for replies. | |
Hey I was wondering how to generate a Windows popup in C. I mean by "Windows popup" as in (for example) when you do a net send message to a PC, a simple Windows popup comes up on the PC you sent the message to with the message. How can … | |
I need help with recursion function. It prints all the prime factors of an input number. My question is how to modify function so that START-GOTO is replaced by a loop? Here is the code: int f(int n,int i) { start: if(n==1) goto start; if(n % i == 0) { … | |
hi guys i've written an bare OS and now im trying to go a little furthur and create a very simple GUI for it . but i have no idea how to create such a thing . my os is running in text_mode though i can change to some other … | |
I am trying to implement a test program to describe what this function does: int mystery( const char *s1, const char *s2 ) { for( ; *s1 != '\0' && *s2 != '\0'; s1++, s2++ ) { if( *s1 != *s2 ) { return 0; }//end if }//end for return … | |
for example i have a void pointer : void *pt; int k=80; pt=&k; now i want to incement it by one byte ,is it just enough to use (++(char*) pt) or I should use (void*)(++(char*)pt) by this asssumption that i wnat to cast it again to int ,char ,... later. | |
Hello, I'm just started to study malloc and realloc, so i just wrote this program to copy two string from user input and consenterate them. then ofcource print it. #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char *str = malloc(3) gets(str); int sl = strlen(str); str = realloc(str, … | |
Hi. I need help with this program: Example input: 2 4 6 -1 7 3 -2 1 Output: 3 3 (longest series of even is 3, longest series of positive is 3) Here is the code: #include <stdio.h> int even(int x) { return x % 2 == 0; } int … | |
I am printing in my c program which deals with structures but not able to understand why getting a small box containing 0001 in box.printing is fine but the uneccessay boxes are coming. I dont know what they actually mean. | |
So I am trying to make my own version of chmod using C, the modifications are to make lowercase add permissions while uppercase remove permissions (instead of using + or - to add and remove). Also, I am trying to print a help message and exit if the command cannot … | |
I have a simple c program outputing a message asking for user input. Then a scanf function reading in user input. When the program is run, the program execute the scanf function first before printf is executed asking for user input. What is wrong with the program? int main () … |
The End.