15,552 Topics
| |
Hmm I was lookin through a recursion program in this book i have here and the only thing I'm having trouble with is the modulus operator. I know that it returns the remainder of 2 numbers. But, suppose I have this: x % y If x > y then the … | |
[ICODE]int main() { int count,rec_temp[]); count=read_temps(int temps[]); rec_temps=hot_days(int count,int temps[]); return 0; } [/ICODE] Can someone identify the error in this code please. I'm using Codeblocks; it says that it "expected a primary-expression bofre "int" " It says the error occurs once in the first function call, and twice in … | |
OK so I use the following code to get a hash of a file and print it to the terminal. I want to then add this hash to a file with other text based data in it, so I assume I need to convert to ASCII somehow. I must also … | |
| |
i really don't know how to use text file i i want to know the step by step procedure... please thank you very much.. | |
how can one read from a file (.dat or .txt) using and linked list. ie. file 1 -> after reading from this list then user enters 1 for next which would print another file. file-> and so on | |
I have a statement in c as 3*3*3%4 and the output is 3 how is that? | |
| Hello, I'm new to C and I'm not sure what is wrong with my code here. After I execute, I get this: Debug assertion failed! [program address] File: fgets.c Line: 60 Expression: str != NULL It's a really simple program. I'm trying to assign family data from the in file … |
below is the code for traversing a binary tree without using recursion but the problem with the code is we require array of pointers to store all the nodes address. in below program the parameter nodes in the function push is an array of pointers to store all the node … | |
Here's my problem, I am getting a bad access on a shared memory line on my producer/consumer program: [CODE]Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0xffffffff 0x00001db0 in main () at Project3.c:120 120 memset(buf, 0, BUFFER_SIZE); [/CODE] [CODE] int BUFFER_SIZE = 200; int *buf; [I]Some … | |
I wrote this code to find the mode of an array of values. [CODE]double mode (double * array, int numItems) { int j, i, maxRepeats = 0; double mode; for(i = 0; i < numItems; i++) { j = 1; while(array[i] == array[i+j]) { ++j; } if(j > maxRepeats) { … | |
I'm trying to create a tree using C and print its tree traversals(preorder,inoreder,postorder) so i decided to start creating a tree first. My program accepts a characters in preorder but it doesn't print the data I entered. Could someone help me? [code] #include<stdio.h> #define MAXNODES 26 void push(); void pop(); … | |
Hello every one! i want to create something like this (show at the bottom of this message as an attachment) but i've no clue how to create this digital payrmid. can anyone please help me with the code please? thanks for your help in advance cheers sh4rif 1 1 2 … | |
so far the user can select a file that he want to open to be copied, is there a way of letting the user selecting multiple files to be copied to one file? i was thinking of looping around asking the user to add another file if the user wanted … | |
delete(int list) { int i, j, row; char temp_last[max], temp_frst[max]; clrscr(); gotoxy(1,21); printf("Delete Data"); printf("\n-----------------"); gotoxy(1,23); printf("Last name : "); gets(temp_last); gotoxy(1,24); printf("First name : "); gets(temp_frst); /*for(i=0; i<=list; i++) { if(stricmp(record[i].last_name, temp_last)==0 && stricmp(record[i].frst_name, temp_frst)==0) { for(j=i; j<list; j++) { temp_last=record[j+1].last_name; /*<------Error on this . line */ temp_frst=record[j+1].frst_name; record[j].last_name=temp_last; … | |
i need help with the following: make a program that would display the nth of the fibonnaci sequence. 1 1 2 3 5 8 13 21 34 55 ... n implement it using both iteration and recursion. | |
i have this code and its output is 54. my question is, can someone please explain to me the process of getting this certain output, which is said to be 54. thank you. :) [CODE]#include<stdio.h> #include<conio.h> int sumS (int n, int m); void main () { int x=2, y=5; clrscr(); … | |
suppose i hv 1 txt file in which i hv declared 1 path name of particular file. i wan to recall that file by using pathname from thaT particular file.say for eg: input file(path.txt) having pathname as "C:\\gp442win32\\gnuplot\\binary\\gnuplot -persist","w".now i wan to call this file in c code in order … | |
Hi This code, compiles fine but results in a segmentation fault and when I comment out the part which adds the null character then the segmentation fault doesn't appear and it removes whitespace from the beginning but not the end. [code] #include <ctype.h> #include <string.h> #include <stdio.h> char *trim(char *s) … | |
I have a problem when I try to compile my code. Sorry in advance for non-english language in code.. npipe.c:78: warning: passing argument 1 of ‘sprintf’ makes pointer from integer without a cast /usr/include/stdio.h:361: note: expected ‘char * __restrict__’ but argument is of type ‘char’ npipe.c:80: warning: passing argument 2 … | |
hi guys! please help me understand anything about recursion and iteration ways of coding. :) (maybe some overview, details or something) thank u. we haven't had any further discussion about this. ;p but our teacher gave an exercise that goes like this: make a program that gets the summation of … | |
Hello. I have encountered a following problem "find all duplicate letters in a 2d char array and replace them with '@'" So for instance if I have this : a a b c The output would be @ @ b c So. I have come up with the following algorithm … | |
Hello everyone, i need help with using recursion in writing quite a simple code, but i'm kind of lost with recursion. The assignment is: When the user enters a certain amount of whole positive numbers and presses enter, the main function calls to the recursive separate functions that do the … | |
Hi to everyone! I have a problem with the following code. Can someone please point to me the error? #include <stdio.h> struct network{ char *name; }network1; int counter=0; main() { void add_network(); add_network(); printf("You typed: %s\n", network1.name); printf("counter is %d\n", counter); } void add_network() { char network_name[150]; puts("Give me the … | |
[CODE] ]void menu() { int option; printf("what would you like to do?"); printf("\n\t1. Create an Archive"); printf("\n\t2. extract an archive"); printf("\n\t3. Exit."); scanf("%d", &option); action( option ); } void action(int option) { int n1,n2; if (option == 1) { // how do i get from here to my code thats … | |
i convert some opengl code from visual c++ 2006 to visual c++ 2010 i mean visual studio framework. problem is in visual studio 10 they r running but mainloop is not working, i mean windows r supposed to wait for key input but it shows and gone at instant. no … | |
after my program finishes i get this message and dont why, can anyone explain *** glibc detected *** ./tryp: double free or corruption (top): 0x089b8008 *** ======= Backtrace: ========= /lib/tls/i686/cmov/libc.so.6(+0x6b591)[0xb7729591] /lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0xb772ade8] /lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0xb772decd] /lib/tls/i686/cmov/libc.so.6(fclose+0x14a)[0xb7719aaa] ./tryp[0x804875c] /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb76d4bd6] ./tryp[0x8048521] ======= Memory map: ======== 08048000-08049000 r-xp 00000000 07:00 1725249 /home/k/cprog/tryp 08049000-0804a000 r--p 00000000 07:00 … | |
hey guys, i was wondering if you could help me with my problem! i made a program that uses 3 arguments as inline commands: argv[0] is the name of the program) argv [1] is the name of the first file argv[2] is the name of the second file The purpose … | |
can someone explain me what is the meaning of the number after the modulo (%) EX. printf("the number is: %10.2f", number); please help me define and understand the number after the % and give example, thanks! |
The End.