15,555 Topics
![]() | |
[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 … | |
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; … | |
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; … | |
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 … | |
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 … | |
[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] | |
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 … | |
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 … | |
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 … | |
![]() | 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 … |
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 | |
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... … | |
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 | |
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(), … | |
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 … | |
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]; … | |
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, … | |
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 … | |
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 … | |
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 … | |
hello everybody, please guide me how to make the communication between two systems so as to transmit the message, using C programming language. thanks | |
[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 … | |
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# … | |
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 … | |
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 … | |
[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]); } … | |
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 | |
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() … |
The End.