15,550 Topics

Member Avatar for
Member Avatar for msshapira

Hi all, I have written recurisve pathfinding fuction from matrix[i][j] to matrix[x][y]. however, it's not returning the right values. It is supposed to return the minimal cost from 2 points using any possible path. all ".value" are the cost to use this Node all ".bestFromStart" are the max of long …

Member Avatar for nucleon
0
109
Member Avatar for monkey_king

Hey, does anyone know if it possible to have something like [CODE] #DEFINE NUM_DEC 4 printf("This is your value:%.NUM_DECf\n"); [/CODE] thanks in advance

Member Avatar for Prabakar
0
96
Member Avatar for RexxX

If I know the sizes I'm using, I can declare the array as: [code]char arr[20][20];[/code] Is this correct? Well, I want to know how to insert a full string into the array of strings. I thought it might be: [code]fscanf(infile, "%s", *arr[i]);[/code] but this line gave me the error "warning: …

Member Avatar for RexxX
0
153
Member Avatar for claretm

Hi All, The gap between consecutive prime numbers 2 and 3 is only 1, while the gap between consecutive primes 7 and 11 is 4. Can somebody help me in writing a parallel program to determine, for all integers less than 1,000,000 , the largest gap between a pair of …

Member Avatar for claretm
0
3K
Member Avatar for ohnomis

Hello, I've been having trouble trying to duplicate this program. My output differs from the sample output I was given for homework. I don't understand whats wrong with my code. [CODE] void displayUnion( iUnion ); union integer_union { char c; short s; int i; long l; }; typedef union integer_union …

Member Avatar for Aia
0
161
Member Avatar for Sharanpreet
Member Avatar for Ancient Dragon
0
38
Member Avatar for gemni7

Hi all, I am trying to point a pointer to another pointer and just failed to get resultm here's my failed code, [code] char *point[] { "This is One" "This is Two" "This is Three" }; char *ptr; ptr = point[2]; printf("%s\n", ptr); [/code] I am getting single space printed …

Member Avatar for Ancient Dragon
0
105
Member Avatar for dinklebaga

Hi All, I am currently trying to write a program that can read individual sectors on a floppy disk using C. I am building the program to run in a 16-bit DOS environment using the Digital Mars compiler with the 16bit DOS add-on. So far I know how to access …

Member Avatar for dinklebaga
0
201
Member Avatar for raghavendra83

Hi , I am trying to use XDR to encode an integer variable. I am trying to use xdr_int function [icode] xdr_int(&xdrs, &i); [/icode] But to use this function I have to set XDR_ENCODE somewhere. I am unable to go about how to do this. How should I proceed?

Member Avatar for Salem
0
119
Member Avatar for ZeRo 00

Guys.... I am writing a shell .I've managed to get the input from the user through a string and then I've tokenised it. Now the problem is do i need to know weather its a programme or should i continue to fork it without knowing it. As all of u …

Member Avatar for Salem
0
65
Member Avatar for skprasat

printf("\nThe Result is : %s %s %s %s %s %s %s %s\n",var[0],var[1],var[2],var[3],var[4],var[5],var[6],var[7]); while executing this i get correct result upto var[4].... and for var[5] and var[6] im geting some garbage valuess, then for var[7] im getg my result... whats wrong in my code.....

Member Avatar for axyelp
0
112
Member Avatar for priyankasaini
Member Avatar for Salem
0
78
Member Avatar for ajhais

Given a n*n grid with free spaces and obstacles in the form an n*n integer matrix. We need to find shortest between any two given points (x1,y1) and (x2,y2) through the free spaces. We are not allowed to move in diagonal. Please help me figuring out an algorithm for doing …

Member Avatar for Prabakar
0
102
Member Avatar for ruri

Hi, I'm new to C, and an assignment for multithreading was just kind of thrown at me, so I'm kind of lost. I need to write a program that creates four threads. The first thread would have to read stdin, writes the char to array of 64 bytes, and after …

Member Avatar for ruri
0
104
Member Avatar for abby2589
Member Avatar for priyankasaini
Member Avatar for beanryu

okay guys, plz help, this is so wierd. I am not an expert in C, in fact, not an expert in anything. I defined a struct as the following: [code=c] typedef struct Fact { char predicate[MAX_TOKEN_SIZE]; struct Fact* valuePtr; struct Fact* next; }Fact; [/code] and i have some code like …

Member Avatar for Salem
0
148
Member Avatar for abby2589

how can i declare this correctly: because i always get an error like, too long declaration. Type of food Name Address Average cost Thai ABC Makati 250 American DEF Pasay 350 Asian GHI Manila 150 Thai JKL Muntinlupa 300 Thai MNO Paranaque 350 American PQR Manila 200 Asian STU Makati …

Member Avatar for Ahmed_I
0
106
Member Avatar for Gaytri Khanna

Hi I am Gaytri i would like to know:- why we use main() function in C. And what is advantages of main() function.

Member Avatar for BevoX
0
202
Member Avatar for Kraizy

Hey guys i was wondering if any of you could help here. I've looked around the forums and found a few topics on word_count, the problem is that they use codes that my class hasn't gone into yet so i cant use either. My problem is that we are supposed …

Member Avatar for axyelp
0
176
Member Avatar for kishore84

Hello friends, Need help in generating random numbers from an array without repeats.Once a number is generated, the number has to be deleted from the array so that only the remaining numbers can be generated from the array the next time we call that function.And it should go on until …

Member Avatar for William Hemsworth
0
2K
Member Avatar for Synforge

I'm in the middle of writing a program where I want to use a single function to grab a Username from one file and a Password from another file. The idea is to pass the file pointers to the function so that each time the function is called it returns …

Member Avatar for Synforge
0
127
Member Avatar for marcosjp

Hello there! I need to open PDF files from a C program. So, initially I have this solution: [code=c] ShellExecute(GetDesktopWindow(), "open", "c:\somefolder\myFile.pdf", NULL, NULL, SW_SHOWNORMAL); [/code] However, this code has its limitations: 1. It works, but a shell window comes up and closes when opening the PDF file. Is there …

Member Avatar for marcosjp
0
161
Member Avatar for akim_atl

I was trying to find the right answer to the question below and here are the 2 answers I come up with: srand(time(NULL)); or srand(clock()); If we want the random number library function to produce a different sequence of values each time the program is run which of the following …

Member Avatar for h3xc0de
0
78
Member Avatar for smb1384

I would like to ask about how to use the timer too... how to use set_timer0, get_timer0, what is the meaning of the value of set_timer0(0)... because I am doing a program that will have a digital waveform, which have high and low voltage...I would like to use timer to …

Member Avatar for death_oclock
0
87
Member Avatar for SagarVaze

I need to get a pointer to a particular member variable of a structure Here's what i have done [code] typedef struct { int var1; other variables ... } structname; ---some other code here--- structname* structptr; int* intptr; intptr=(int*)&(structptr->var1) [/code] but this isn't working. What's the correct way to do …

Member Avatar for Aia
0
2K
Member Avatar for CoolAtt

Hi. am using fgets() to read lines from a text file. the file is being updated after a few seconds. i want to read and process the last appended line at the end of the file. i tried the following: [code=c] while(true){ //infinite loop if(fgets(line,size,fp)!=NULL) process line. } [/code] plz …

Member Avatar for CoolAtt
0
707
Member Avatar for Skorpion

HI can some one figure out my mistakes in this program? [CODE=C]#include<stdio.h> #include<conio.h> void main () { int num,i; clrscr(); printf("\nprint any number:"); scanf("%d",&num); for (i=2; i==num; i++) { if (num%i==0) printf("\nprime number"); else printf("\nnot a prime number"); } getch(); }[/CODE] i want that it tell the user whether the …

Member Avatar for Skorpion
0
78
Member Avatar for Logi.

Hi there, I am trying to write a program to send an HTTP request (eventually to view the raw HTML page) but i can't seem to get my requests to send or receive properly, intially when i ran this it would receive about 4190000 bytes (rough guess) but after running …

Member Avatar for xitrum69
0
248
Member Avatar for Rein Valdez

Hello Daniweb IT Community, this is the somehow my code for this problem of mine. My only problem would be in the portion of getting the cents and the Billion it just because of the limitation of the long datatype? I really need some opinions on how I can solve …

Member Avatar for Rein Valdez
0
404

The End.