15,552 Topics

Member Avatar for
Member Avatar for blackrobe

Hey, I have a problem that I'm not sure if its from running on windows or not. Lets say I have the following MakeFile for compiling and creating the executable of 'target.c': [CODE] FLAGS = -Wall -g all : target target : target.o gcc ${FLAGS} -o $@ $^ target.o : …

Member Avatar for Ancient Dragon
0
104
Member Avatar for Unidennn

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 …

Member Avatar for phpbeginners
0
286
Member Avatar for somename

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 …

Member Avatar for somename
0
130
Member Avatar for johndoe444

[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"); …

Member Avatar for kaoni317
0
111
Member Avatar for gerard4143

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 …

Member Avatar for gerard4143
0
133
Member Avatar for funtoknow

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 …

Member Avatar for pebbles
0
388
Member Avatar for vincenzorm117

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?

Member Avatar for vincenzorm117
0
104
Member Avatar for Encrypted

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] …

Member Avatar for Encrypted
0
113
Member Avatar for EvilNerd

Is it possible to put a function inside an[ICODE] if-else[/ICODE] statement? [CODE]if (condition) { // function here } else { // function here }[/CODE]

Member Avatar for WaltP
-2
55
Member Avatar for Tango2010

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 …

Member Avatar for WaltP
0
159
Member Avatar for orwell84

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 …

Member Avatar for orwell84
0
111
Member Avatar for tquiva

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 …

Member Avatar for WaltP
0
118
Member Avatar for ShortYute

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 …

Member Avatar for Salem
0
181
Member Avatar for sumitg979

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 …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for begineer_26

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 = …

Member Avatar for stewie griffin
0
72
Member Avatar for asm2hex

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 …

Member Avatar for mitrmkar
0
78
Member Avatar for tquiva

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 …

Member Avatar for WaltP
0
74
Member Avatar for tquiva

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 …

Member Avatar for tquiva
0
95
Member Avatar for hwlibra083

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. …

Member Avatar for hwlibra083
0
172
Member Avatar for neigyl_noval

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 …

Member Avatar for neigyl_noval
0
291
Member Avatar for infrapt

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?

Member Avatar for Ancient Dragon
0
71
Member Avatar for cyberguy007

[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 …

Member Avatar for WaltP
0
153
Member Avatar for COKEDUDE

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 …

Member Avatar for Dave Sinkula
0
128
Member Avatar for COKEDUDE

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 :(.

Member Avatar for WaltP
0
109
Member Avatar for HBK_100

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 …

Member Avatar for abhimanipal
0
100
Member Avatar for newcuser

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 …

Member Avatar for mitrmkar
0
404
Member Avatar for tquiva

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 …

Member Avatar for jonsca
0
122
Member Avatar for paddy8788

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 …

Member Avatar for paddy8788
0
147
Member Avatar for Morrac

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 …

Member Avatar for Morrac
0
110
Member Avatar for mattitude

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

Member Avatar for mattitude
0
35

The End.