15,555 Topics

Member Avatar for
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
197
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
Member Avatar for gunnerone

Hi I am trying to validate a URL in-putted by the user to check whether it is syntactically correct. [CODE] #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <regex.h> printf("Enter the website URL:\n"); fgets(str, 100, stdin); if (!strcmp(str, "\n")) { printf("Empty URL "); exit(2); } regex_t regex; …

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

I just have a quick question. Say I have a struct for the purpose of commenting in which it could be filled up or left blank depending on the user. Therefore, I need to dynamically allocate memory to the array comments. [CODE] typedef struct userComments { char comments; } name; …

Member Avatar for zeroliken
0
131
Member Avatar for vired

hello all! i need help regarding my C programming homework of the Conway's game of life. i have to make a C program that will read a textfile containing a 25x25 matrix of 'X' or 'blank space' and will print its content. This will serve as the initial generation and …

Member Avatar for zeroliken
0
910
Member Avatar for jbennet

My simple Serial Port code doesnt work. Not sure if its my code, or my USB adapter. Can someone try it / tell me what ive done wrong? [code] #include <stdio.h> /* Standard input/output definitions */ #include <unistd.h> /* UNIX standard function definitions */ #include <fcntl.h> /* File control definitions …

Member Avatar for jbennet
0
242
Member Avatar for romaineo

[CODE]#include <stdio.h> #include <string.h> #include <stdlib.h> int main(){ char name[80]; char *searchptr; int i, t; for(i=1; name[i]!=EOF; i++){ printf( "Enter name\n"); scanf("%s", &name[i]); } for(t=i; t<=0; t--){ printf(" name[%d] == %s", i, name[t]); getch(); return 0; }}[/CODE]

Member Avatar for -[xxxxxxx]-
0
107
Member Avatar for bervic

i hove a problem about hot to write a program to determine if a number entered by a user is a prime number. Program Input is : Prompt user for a number between 1 and 1000. the probable Program Output is: Echo the user input, display whether the number is …

Member Avatar for -[xxxxxxx]-
0
156
Member Avatar for faithful4ever

Hi, I'm trying to define a dynamic array that consists of an email address and a home address. How can I define them dynamically using malloc() in the below struct? [CODE] typedef struct entry{ char name[40]; /* contains name */ char phone_number[9]; /* contains phone number */ struct entry *next …

Member Avatar for -[xxxxxxx]-
0
146
Member Avatar for swissknife007

I am trying to implement a program for finding the remainder on division of 2 numbers n2/n1 such that n1 is of the order of 2^32(having a few digits) and n2 is the order of 2^65536(having about 20000 digits) So far I have stored them in an array digit by …

Member Avatar for Banfa
0
145
Member Avatar for karoma

I'm trying to create an array of structs, of which the array size is defined by the user in the program. eg. p[0], p[1], p[2]..... [CODE] typedef struct { int score; }player; void main() { int numPlayers; printf ("\nEnter number of players (1 - 4)\n"); scanf ("%d", &numPlayers); }[/CODE] The …

Member Avatar for death_oclock
0
224
Member Avatar for slygoth

Hey guys i need to color code [CODE] printf("hello World");//how do i change this to green printf("How are you");//How do i change this to yellow or something [/CODE] How do i change the color of the text inside the printf

Member Avatar for Ancient Dragon
0
137
Member Avatar for nishant3316

hi, I recently wrote this code to calculate the hamming distance between any two binary numbers... The program accepts the numbers in decimals, performs a bitwise XOR operation and returns the HD... However, it returns the Hamming distance in decimal... that is if after XOR it gets something like 0010... …

Member Avatar for SHIVANGII
0
622
Member Avatar for c++ lover

Hello , I'm new here and new to c/c++ programming. Can you guide me how to extract user from path like : /home/[COLOR="Red"]user[/COLOR]/public_html Please help me , thanks a lot

Member Avatar for zeroliken
0
78
Member Avatar for faithful4ever

Say I have a struct: [CODE] typedef struct entry{ char name[40]; /* Contains name */ char phone_number[9]; /* Contains phone number */ struct entry *next ; /* next is used to navigate through structures. */ } contact; [/CODE] I have a pointer: [CODE] contact *email, *address; [/CODE] In my main(), …

Member Avatar for zeroliken
0
131
Member Avatar for JC11

I'm running the following in Eclipse using the Cygwin as the toolchain and the error code is executing. I get "cannot get params about stdin: Inappropriate ioctl for device". It's fine in Linux. I've been able to run other code that doesn't use this header. Also, how can I set …

Member Avatar for JC11
0
120
Member Avatar for abhishekagrawal

Dear All, I have written a code to implement an algorithm for base conversion from decimal to any base between 2 and 36 given in RG Dromey. Below is my code and I have a few questions relating to it: [CODE] #include<stdio.h> #include<stdlib.h> int main() { int newbase,zero=atoi(0),q,ndigit=0,r,ascii,i; char newrep[100]; …

Member Avatar for thines01
0
276
Member Avatar for cdea06

I'm a little stumped on a section of code in my program. I'm trying to take in a string of chars and then store each word within that string separately in an array of strings without using stdtok and then output them with only a single space separating each word, …

Member Avatar for cdea06
0
253
Member Avatar for zur1ch

So i am making a piece of program In C but i cant get to check the system time and execute IF the time is equal to the systems time. in Plain english this is what my program is supposed to do. # # LIBRARIES # 1. Check the system …

Member Avatar for BobS0327
0
125
Member Avatar for pichi20

Hi, I'm only starting my program and I already have this error but I really don't understand which ones are causing this shift/reduce conflict and why. Can please someone help me? it says I have 2 conflict shif/reduce. This is the grammar: [CODE]Start : Declarations/* put your RHS for this …

0
143
Member Avatar for shibu2all

is this logic correct, where does counting starts in a link list, is it from 0 or 1. b'cos when i am ading item 60 at loc 4, den the output is : item number 1 contains 30 item number 2 contains 20 item number 3 contains 10 item number …

Member Avatar for zeroliken
0
178
Member Avatar for python_adz

hello everybody, please guide me how to make the communication between two systems so as to transmit the message, using C programming language. thanks

Member Avatar for python_adz
0
159
Member Avatar for swissknife007

[CODE]There is a single ring road that runs over the circumference of this circle and connects all the boarding points. There are also N - 1 different shuttle agencies available in Bhiwani. For every different boarding points A and B there is exactly one shuttle that connects these points and …

0
97
Member Avatar for jnmisa

hello, I am a new learner of C#, I will like to know Which way is the best to learn, Either to use Microsoft Visual C# or Notepad? The book am using to learn make use of Microsoft Visual C#, and Also Please what is the Different between C, C# …

Member Avatar for jussij
0
155
Member Avatar for aldrin_ison1

Hi! I'm new to C and I'm having some problems in my program. It opens a .txt file then copies this to another .txt file but replaces a certain word with another word. It uses command line arguments. Example: //inside text.txt love is patient love is kind ... ./change love …

Member Avatar for histrungalot
0
457
Member Avatar for PureHashIsh

I am trying to write a function that compares two text files (test1.txt and test2.txt) word by word, the function is supposed to print "files are equal", "files differ: word %d" (if word 13 then past 12 words were equal), and "EOF on [filename]" (the files were equal word by …

Member Avatar for PureHashIsh
0
2K
Member Avatar for slygoth

[CODE] FILE *ranch; FILE *myfile; char line[500]; case 1: ranch=fopen("garrudaRanch.txt ","w+"); if(ranch != NULL) { printf("Enter amount of Corral: \n"); scanf("%d",&corral); fprintf(ranch,"%d\n",corral); printf("Enter size of Corral: \n"); scanf("%d",&corrals); fprintf(ranch,"%d\n",corrals); } fclose(ranch); break; case 2: myfile=fopen("garrudaRanch.txt ","r+"); if(myfile != NULL) { //fscanf(myfile,"%s",line[1]); printf("Number of Corral: %s",line[1]); printf("Size of Corral: %s",line[2]); } …

Member Avatar for Ancient Dragon
0
132
Member Avatar for sutharbhavisha

Hello, I have one dataset as one arraylist. In that the columns values are in string as high, low, medium.. so how i display that values as string in c or java? pl reply me

Member Avatar for thines01
0
31
Member Avatar for Jammie

Hi there, I tried binary addition. It seems to work fine. Could someone tell me if there's a better way of doin this or any bugs that could be uncovered in the code below? I appreciate your time. Thanks, Tina [code=c] #include <stdio.h> void binaryAdd(char *, char *); int main() …

Member Avatar for arunsolo1984
1
979

The End.