15,551 Topics
| |
Ok so I am working on a hash map but I ran into trouble with reading in the input. I need to be able to read in the input from a file if specified if not from the console. Thats not a problem but when it comes to reading it … | |
Hi, I'm supposed to write a code of finding the shortest path of VRP... Assume that shortest path = shortest time. "Given a set of locations and a set of homogenous vehicles, find the minimum time of tour that visits each city exactly once by any of the given vehicle. … | |
Could you please tell pictorially difference bw these 2 codes(o/p is same) and suggest any source where i can once in for all resolve doubts in pointer to pointer problems except "K&R in ANSI C" [CODE]#include <stdio.h> #include <string.h> void pointer(char**); void main() { char *p[]={"name","fame","claim"}; pointer(p); } void pointer(char … | |
Hi folks, I need a solution for following scenario. 1. Suppose two processes running simulteneously. 2. Process (P1) has already locked a mutex (M1). 3. Process (P2) is trying to lock same mutex (M1) but as it is already locked by (P1), P2 is waiting for unlocking (M1). 4. Now … | |
i am trying to write a program that will prompt the user to enter test scores terminated by a negative number. and then find the min max and average of the scores inputted. i have gotten everything to work except the average. the assignment says i can only use variables … | |
Hi, I'm having some very hard time with my header files when working with linked lists. I'm not too sure what I need to define in them except for the prototype functions. The way to create strucs within the header files confuse me. This first file is the header for … | |
I am trying to make an encrypter, but as you can see, it's not working. str[] have an undeclared array size, i know that theres an option to make it with a pointer array, but i really want to make it a fixed size, also, so i can skip the … | |
IM HAVING PROBLEM WITH THIS PROGRAM, GOING BACK TO THE MAIN PAGE AND SELECTED PAGE, IF THE USER ANSWER NO, THE PROGRAM WILL GO BACK TO MAIN MENU IF THE USER ANSWER YES, THE PROGRAM WILL COMPUTE THE SAME PROBLEM. help PLS... THE PROGRAM BELOW WONT GO BACK TO COMPUTE … | |
Hello; I have 2 questions: 1- I know you can allocate memory to an array dinamically in C and C++. But, can this be done if the array is part of a structure? 2- Can the size of a dynamic array automatically grow up to a maximum or do you … | |
Hello everyone, I have a program that intends to create a doubly linked list of structures, using the following header (q1.h): [CODE=c]typedef struct lNode* ListNodePtr; typedef struct lNode { char* string; ListNodePtr next; ListNodePtr prev; } ListNode; [/CODE] This is my implementation: [CODE=c]#include "q1.h" #include <stdio.h> #include <stdlib.h> #include <string.h> … | |
i did a simple bubble sort but it is ot working . help me out. [CODE] #include<stdio.h> main() { int i,j,k; int a[]={7,9,4,2,3,6}; for(i=0;i<7;i++) for(j=i+1;j<7;j++) if(a[j]<a[j-1]) { k=a[j]; a[j]=a[j-1]; a[j-1]=k; } for(i=0;i<7;i++) printf("a[%d]==>%d",i,a[i]); } [/CODE] | |
As this is my first post on this forum I want to say "Hello!" to everybody and I hope that we'll help each other as much as we can and we'll be very good friends. :) So, this is my problem ( a rather simple one but I don't know … | |
hi can u ppl help me on this. can i use multiple enums in a single c program, if so is there any constrain on it? [CODE]enum pattern1 {red, green, yellow} pt1; enum pattern2 {orange, blue, black} p2; enum pattern3 {white, grey, violet} p3;[/CODE] is this possible???? | |
I want my program to just continue as long as the user press any key How do we do it with only use of scanf?? for example: int main(void) { while(1) /*my program goes here*/ printf("Hit any keys to continues......"); scanf // how? } | |
i have to write a program, in which i have to make pointer to point to the character, where it last occured in a string. For example: String: Lord of the rings Character: r Pointer points to the last 'r' in the string, that is in the word 'rings'. If … | |
I want to Write a program that determines the day number (1 to 336) in a year for a date that is provided as input data. As an example, January 1, 1994, is day 1. December 31, 1993, is day 365. December 31, 1996, is day 336, since 1996 is … | |
Greetings all; what I'm trying to do is create an array of structs dynamically by using functions for allocation, display, and then freeing memory. I'm *able* to do the process if it's within scope of the foo declaration, but the initFoo function throws an exception. I *think* it's the order … | |
hi guys .. i have an assignment .. and i didn`t now that i have to do it by tomorrow and now i have no time .. i will be thankful if you can help me.. "Write a program that determines the day number (1 to 336) in a year … | |
how can i convert this into a struct? the program is prnting all the even nos [CODE]void main() { int num[5],even[5],count,j=0; clrscr(); printf("Enter 5 numbers\n"); for(count=0;count<5;count++) { scanf("%d",&num[count]); } for(count=0;count<5;count++) { if((num[count]%2)==0) { even[j]=num[count]; j++; } } printf("EVEN:\n"); for(count=0;count<j;count++) { printf("%d\t",even[count]); } getch(); }[/CODE] | |
I'm working on a tcp server and client for linux. I want the tcp server to send a 10MB file to it on request and I want the client to save it to local disk. I would appreciate any help on it. Thanks for the help. jdm server: [CODE] /* … | |
[CODE] unsigned int *a; a = (int*)malloc(1*sizeof(int)); a[0] = 10; a[1] = 20; a[100] = 40; printf("%u",a[100]); [/CODE] I have created a pointer named a and allocated 'single' int space for it but still i can store and retrieve more than that. This code runs. Then what is the need … | |
hello everybody, please help me in solving the problem of finding the XOR value of 4 bits as i require it in my project. i tried ^ sign, but it doesnt work for four variables? kindly help | |
Hello everyone, I've been having a problem with some of my scanf() functions being skipped after I input a string with a space in between (e.g Jack Daniels). I've been trying to fix it, but it has been driving me crazy. [CODE]#include <stdio.h> #include <stdlib.h> struct Student { int studentNumber; … | |
i got no idea how to correct the error,can help me? this is a chem quiz that contain 20 question but i need to random everytime 10 question,other than this,also have a calculator,& mini games [CODE]#include<stdio.h> #include<math.h> #include<stdlib.h> #include<time.h> #include<windows.h> int main (void) { int option,question,i,count,z=0; char choice,game,quit; int selection; … | |
Greetings. I'm currently implementing small ANN on my microcontroller. I need to calculate sigmoid activation function. The problem is that I cannot use standard c libraries like math.h so I need custom written pow function. This is how it will be used:pow(e,-(someFloat)); Did anyone have already implemented something similar ? | |
hi when i try to use atof i get different values every time i run my app code: [CODE]#include <stdio.h> #include <string.h> #include <math.h> int main(int argc, char **argv){ char* a = "100"; double b = atof(a); printf("%f", b); }[/CODE] why do i get different results everytime i run my … | |
Dear all, I'm a C beginner and I was doing a small practice nested loop on C when I got a very strange error which when the console opens tells me that my program has stopped working. here is the code: [CODE] #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> … | |
is it possible in C to do an unfix size array like in Java ? if so, howto ? thx guys Dark | |
Hi, I want to filter .BMP image with 3x3 digit matrix. Basicly it is multiplying image pixels by numbers in matrix. Any suggestions how it should be done? I know that i have to open a file using fopen() I did that. Should I just loop through whole image and … | |
im writing a chat server in c and am need help. my server can write to a socket, the client can read from the socket. How do i have the client write to the socket and have the server read from the client socket? server.c [CODE] #include <stdio.h> #include <unistd.h> … |
The End.