15,552 Topics

Member Avatar for
Member Avatar for faithful4ever

My struct is as such: [CODE] typedef struct pqueue { char str[20]; int priority; }pqueue; pqueue q[MAXQ]; [/CODE] When I'm displaying the items in the priority queue, I am trying to sort it by priority, so I have the following comparison function: [CODE] int compareByPriority(const void *a, const void *b) …

Member Avatar for faithful4ever
0
123
Member Avatar for ilovephil

How to add the numbers between nodes example. input 1*2+3 first 2 and 3 will add and it will become 1 5 nodes then 1 * 5 = 5 then node will becaome 5 only this is my sample program #include<stdio.h> #include<stdlib.h> #define p printf #define s scanf struct node …

Member Avatar for begame
0
157
Member Avatar for begame

Hey there! So I have am writing a multi-chat client for my college course. I have completed most of it, however there is a problem which I am unable to identify. When I conect multiple clients to the server only the the last client to connect is able to send …

Member Avatar for begame
0
186
Member Avatar for ilovephil

How to add number in link list using stack POP AND PUSH example i have 1+ 2+3 input the last two operands will first do the addition example and it becomes 1 5 and i put + and will become 6 how? any idea?

0
53
Member Avatar for ilovephil

How can i store strings in my program. #include<stdio.h> #include<stdlib.h> #include<string.h> #define p printf #define s scanf struct node { char nbook; struct node *next; }; typedef struct node *nodepointer; void addbook(nodepointer &head,char book) { nodepointer newnode; newnode=(nodepointer)malloc(sizeof(struct node)); newnode->nbook=book; newnode->next=head; head=newnode; } void display(nodepointer head) { if(head==NULL) { p("\nNothing …

Member Avatar for Ancient Dragon
0
208
Member Avatar for luislupe

I programmed some functions that use a dynamic array of [CODE=c] double ** array [/CODE]. But know, I want to test the results with a small array of 5 x 5 elements and use this array in the functions I coded. My problem is that I can find no way …

Member Avatar for luislupe
0
250
Member Avatar for TreeBranches

My program begins by opening a dictionary file, the first line of which contains the number of words in the dictionary. If I print the words immediately after scanning them into the arrays, they appear fine, but if I later examine a previous entry, I can see it has been …

Member Avatar for TreeBranches
0
215
Member Avatar for vedro-compota

Hello everyone)) Guys please tell me - is there any way to create thread in lunux , which will not executed itself (at all) - until will get SIGCONT signal? I can't thread self stopping after creation , because in this case - we cann't be sure that the thread …

Member Avatar for vedro-compota
0
354
Member Avatar for faithful4ever

I'm trying to get a user's input repeatedly until he/she types in 'done'. So what I have done is: [CODE] printf("Enter a name to save and its priority\n"); scanf("%s %d", q[rear].str, &q[rear].priority); [/CODE] How can I check for the user's input until he types the word 'done'? So if the …

Member Avatar for faithful4ever
0
134
Member Avatar for ilovephil

As you can see this is my program.my problem is how to store strings in my program I can store only single character.. any one can help me? =( #include<stdio.h> #include<stdlib.h> #include<string.h> #define p printf #define s scanf struct node { char nbook; struct node *next; }; typedef struct node …

Member Avatar for Banfa
0
134
Member Avatar for IcyFire

Im trying to write a program that will scan both characters and numbers from a user then put the number into an array or call another function based on the user input. For example the user will type 'Insert 3' and this will call the function to put 3 into …

Member Avatar for IcyFire
0
181
Member Avatar for ilovephil
Member Avatar for VernonDozier
0
58
Member Avatar for ilovephil

can i return a value using CHAR DATA TYPE? NOT INT? ex.int data; int value(ex.data) return data; how about this ex.char name; int(ex.name) return name; possible or not?

Member Avatar for ilovephil
0
84
Member Avatar for cono1616

Hi I am fairly new to C and was wondering if anyone can help me out. I am trying to take a 2D array and scan for individual letters. I have a hangman game and the program takes a word from words.txt and assings it to the char word[20][30] For …

Member Avatar for thines01
0
23
Member Avatar for shean1488

Hi everybody, I just start lerning C I'v heard a lot about pointers but not really sure were to put them. (or may be I'm wrong may be I just made some mistake) pls take a quic look. [CODE]/* This program will delete all simbols * from s1 that s2 …

Member Avatar for zeroliken
0
84
Member Avatar for str91
Member Avatar for zeroliken
0
129
Member Avatar for eranre

I was wondering if anyone can assist me with a problem that I have with C Bluetooth programming (Linux Bluez). I am using Ubuntu 10.04, BlueZ 4.60. My goal is to have a L2CAP socket in which there will be minimal delay for sending data between 2 computers. So far …

0
178
Member Avatar for M09

Hello I have an experience in programming previously, and now i want learn C . how can i learn it, i means where i can learn it . in fact i am looking about sources to learn like books,web sites, and vedios. and i hope you Heuristic to the good …

Member Avatar for M09
0
263
Member Avatar for henriquec

i am starter in c/c++ i need to convert this: [CODE]cout <<" "<<ch1<<ch2 <<" "<<ch1<<ch3 <<" " <<ch0<<" "<<ch1 <<" "<<ch1 <<ch4 <<" "<<ch1<<" "<<ch3<<ch5<<" "<<ch0 <<" " <<ch2<<ch3<<" "<<ch1<<ch5<<ch0<<" "<<ch1<<ch4 <<"\n";[/CODE] in printf, but i dont know how to do it.

Member Avatar for thines01
0
232
Member Avatar for soo5Lo6k

Hi, I am programming some console application that updates itself periodically from Internet. (windows.h + pthreads for win32) I want to do something like: [CODE] MAIN FUNCTION: create thread launch updater THREAD: infinite loop - starts the main application, exits if application ended normally but when it was killed by …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for zingwing

By using an if statement how could i get a character to detect end-of-file. i was thinking something like this: [CODE] char a = '\0'; int count = 0; if(a == EOF) { count++; }//endif [/CODE] but it doesn't seem to detect the end-of-file. Any idea would be appreciated. Thanks …

Member Avatar for Ancient Dragon
0
144
Member Avatar for cali_kid

[code] #include <stdio.h> int max(int x, int y); int min(int x, int y); int main() { int grade, total, counter, avg; total = 0; counter = 0; printf("Enter grades: (-1 to end list)\n"); do { scanf("%d", &grade); if(grade != -1) { total = total + grade; counter = counter + …

Member Avatar for Tumlee
0
197
Member Avatar for niyasc

Following is the one of code written by me for shared memory. Problem is that program donot come outside from marked loop and read numbers infinitely. "common.h" [CODE] struct common { int a[10],b[10],c[10],flag; }; [/CODE] p1.c [CODE] #include<stdio.h> #include<unistd.h> #include<stdlib.h> #include<sys/shm.h> #include"common.h" int main() { int running=1; void *shm=(void *)0; …

Member Avatar for niyasc
0
209
Member Avatar for <mono>

void ADD_QUOTE(){ do{ printf("\nPlease enter Length:\n"); scanf(" %d ", &length); }while(scanf(" %d ", &length)<200 || scanf(" %d ",&length)>4000); { while ((length[count] = getchar()) != '\n') putchar(length[count]); } return; do { printf("\nPlease enter Size:\n"); scanf(" %d ", &size); }while (size[count]<200 || size[count]>4000); do { printf("\nEnter which Board type you want: 'A'-4mm …

Member Avatar for zeroliken
0
223
Member Avatar for swissknife007

I am making a program to store all the powers of 2(1,2,4,8...) till 2 ^50000. Although I am getting the answer,I am not getting my answer in the required time limit. Any suggestions? How should I store the numbers? Here is my stupid code as of now [CODE] #include<stdio.h> #include<math.h> …

Member Avatar for histrungalot
0
202
Member Avatar for zingwing

I need help figuring out how to count sentences from a .txt file. The following guild lines are what is considered to be a sentence: 1. A TERMINATOR followed by two spaces 2. A TERMINATOR followed by one space and end-of-line 3. A TERMINATOR followed by end-of-line 4. A TERMINATOR …

Member Avatar for zingwing
0
281
Member Avatar for Raymond Pua

hello! how to make a program that replaces words in a file and replaces it with another word and saves it to another file. Using command line arguments.?

Member Avatar for WaltP
0
194
Member Avatar for eirrag

[code]#include <stdio.h> #include <stdlib.h> #include <time.h> # define clrscr() printf("\033[H\033[2J"); struct treeNode { struct treeNode *leftPtr; int data; struct treeNode *rightPtr; }; typedef struct treeNode TreeNode; typedef TreeNode *TreeNodePtr; struct queueNode { TreeNodePtr data; /* define data as a char */ struct queueNode *nextPtr; /* queueNode pointer */ }; /* …

-4
122
Member Avatar for Mr.UNOwen

Hello, I'm using pause() to suspend threads until I need them and pthread_kill(thread, SIGCONT) to resume. It works the first time over with the thread unpausing the first time I send SIGCONT, but not the second time around. Does sending the signal cause it to be ignored and if so, …

Member Avatar for histrungalot
0
195
Member Avatar for siqu

Hi all. I have this error and i cant figure out what is wrong here, i have tried to google and used a few methodes to c what is wrong but, naah, no luck. [I] pic 16f887 HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.81 Copyright (C) 2010 Microchip …

Member Avatar for siqu
0
457

The End.