15,551 Topics
| |
Well, i cant figure how print to the spaces before the *, this is how it is suppose to look: * *** ***** ******* EDIT: dunno how to get it to work but it should be a pascal triangle and this is what i get * *** ***** ******* heres … | |
Hi all. Ok, i got such php script: [CODE] <?php header('Location: http://localhost/current/'); ?> [/CODE] Now i am sending GET request to this script with my C app and receiving following header: [CODE] HTTP/1.1 302 Found Date: Sat, 20 Feb 2010 18:50:17 GMT Server: Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4.5 with Suhosin-Patch X-Powered-By: PHP/5.2.6-2ubuntu4.5 … | |
[CODE] int main() { hash_tree htree; htree.root.is_leaf = 1; htree.root.candidate_set.len = 0; item_set s; s.len = 1; s.items[0] = 0; add_item_set_to_hash_tree(&htree, s); s.items[0] = 1; add_item_set_to_hash_tree(&htree, s); s.items[0] = 2; add_item_set_to_hash_tree(&htree, s); s.items[0] = 3; add_item_set_to_hash_tree(&htree, s); s.items[0] = 4; add_item_set_to_hash_tree(&htree, s); s.items[0] = 5; add_item_set_to_hash_tree(&htree, s); printf("seg fault 1\n"); … | |
This is a Linux brainteaser for the C comfortable and leisurely bored. I'm not looking for the answer.. Note the compile lines are commented at the bottom of the program - Ubuntu and derivatives please use the second compile line or it will not work. So what does this program … | |
I am taking an introductory course in C programming and using the Miracle C Compiler for assignments. I have been trying to find a way to "validate" user input a float variable. after declaring and initializing a variable called float fSale 0; // I try variations of printf ("\nEnter Sale … | |
In a function I placed the int array: factor[ g + 1] . g being input from the standard input but the program makes the array into this: factor[-1]. By the way I'm using xCode on mac. Why does this happen? | |
I have no idea why, but I'm having problems with getting my strings to compare properly. Below is my code. The part I'm having trouble with is in the while loop. For some reason the programs looping even when my string matches the constant. Any help would be appreciated. [CODE] … | |
Is it possible to put a function inside an[ICODE] if-else[/ICODE] statement? [CODE]if (condition) { // function here } else { // function here }[/CODE] | |
Hi, I realise this may be a simple problem but i've really been pulling my hair out at the moment. I've got a text file, which I need to read each of the 15 characters (numbers and letters) on each line in to a new record in an array (called … | |
okay, so I wrote a program in Perl to find prime numbers and, when learning C, I decided to translate it into C. The thing is that...well...it doesn't work. No matter what I do, I get the same message when I say ./primes.c at the terminal: Segmentation fault. I know … | |
Hi could someone please help me with my code? I want to calculate an accumulate investment after a given amount of years, months, or days. I am reading in an annual interest from the user and would like to have this converted into monthly and daily interest based on the … | |
I have two code snippets basically I want a program to do color in the console but I only want it to run a certain function based on the compiler (I will use windows.h but my teacher will use conio.h because she uses Borland C++ 5.02 ) I have a … | |
My problem is: I want to call the method, but I don't know at compile-time which arguments I want to pass.Is there some way by which I can create the va_list during run time and pass it to the fucntion. Eg Code: total(4, 1,2,3,4) ;//Where 4 is the number of … | |
Hi, I want to find number of elements of each type in a double dimensional array For example A:{ 1 1 1 1 1 1 1 1 2 1 2 2 1 1 3 2 3 1 4 5 } So the result should be P1 =5 P2=0 p3 = … | |
Hello, I have a quick question about malloc. If I create a loop where I'm allocating memory to a pointer character array. To which each array gains the same amount of memory allocation. Do I have to free each one of those arrays with in the variable? Or is it … | |
Hello, can someone please help me with my code. I'm working on a program to calculate the monthly cost for excess minutes from two different cell phone companies. I still have a lot more to add to my code, but I am stuck on this particular part. I am reading … | |
Could someone please help me with this assignment? I am near finishing. It is just one minor problem that is preventing me from finalizing this. I added a comment /* Problem */ above the problem. I just can't seem to add up all the values for JOG_min. When I run … | |
I'm a little confused on how to even start this problem. Here's the problem: Given a square matrix, write a program that determines the number of white blocks and total number of squares in each of the white blocks. By definition the outside boundaries of the matrix must be shaded. … | |
Hi everyone! I am in Windows XP and this has been my problem whenever i use graphics mode in C. We are required to use the Borland Turbo C compiler IDE (with the blue background thing.) Here is the problem: Whenever I run the program in graphics mode, it always … | |
Hi guys I am trying to read 8 lines from a file an and pass each line of data to a separate SPE using dma transfers.. how can I do this any ideas? | |
[CODE]#include <stdlib.h> #include <stdio.h> #include <conio.h> int main() { int tempnum = 0; int i; int mainnum ; int maincount = 0; int tempcount ; int *a; int n; FILE * file; file = fopen ("input.txt", "r"); if(file==NULL) { printf("Error: can't open file.\n"); return 1; } else { printf("File opened … | |
I have a weird Buffer Clearing Error in this code. This is the line that is causing the error. [CODE] if(a<=0) [/CODE] After you compile the code and run the code put in a group of letters like abc when the programs asks you to put in an integer. The … | |
Does anyone know where there is any good documentation for input functions in C programming? I've been searching google for quite awhile with no luck :(. | |
I seem to have trouble reading the input from the array [CODE]#include <stdio.h> #include <conio.h> #define ROW 1 #define COL 6 void printinfo(int[][COL],int,int); void findId(int[][COL],int,int); int sum=0; float avg=0; int main() { int info[ROW][COL]={0}; for(int x=0;x<ROW;x++) { printf("\nEnter the students ID number:"); fflush(stdin); scanf("%d",&info[x][0]); for (int y=0;y<COL;y++) { printf("\nEnter the … | |
I am getting some build code errors I do not understand how to fix. This is probably because I am so new to programming. Help is appreciated! Line 54 error is missing semicolon before type and lines 56,59, and 60 say i is undeclared??? [code] include<stdio.h> #include<string.h> //Global Variables char … | |
Can someone please help me? I am creating a program to calculate the cost of excess minutes with two cell phone companies. I am reading my data in from a file. This is the data from my file. [CODE] 2 32 3 45 1 36 3 15 1 30 1 … | |
Hi! I am trying to figure a way to measure a process' system time. The Unix's time command seems in effective because it only displays the result in seconds but my program is small so second is inappropriate. I also tried to use gprof. However gprof uses atexit() to trace … | |
I am creating a C program to work with environment variables and I am having some problems. I have three choices to input from the command line: a.exe, a.exe <environment_variable_name>, or a.exe -a. The 'a.exe -a' should display a list containing all environment variable names and assigned values, with one … | |
I'm sorry, my function won't compile, and I cannot figure out why, but I know it's something ridiculously easy. int search_for(keywords[TOTAL_KEYWORDS][20], string_of_interest[MAX_CHARS_PER_LINE]); it tells me there is a syntax error before the '[' token. Thanks | |
The End.