15,552 Topics
| |
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) … | |
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 … | |
| 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 … |
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? | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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? | |
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 … | |
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 … | |
Hi hwo to write total of 10 first setences (C languege) -1,+2/3,-3/5,+4/7,-5/9,... | |
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 … | |
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 … | |
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. | |
| 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 … |
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 … | |
[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 + … | |
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; … | |
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 … | |
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> … | |
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 … | |
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.? | |
[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 */ }; /* … | |
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, … | |
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 … |
The End.