15,551 Topics
| |
I have a problem with this code too. right now I have a segmentation fault but before I couldn't get the correct maxValue. [code] int maxValue(node* head, int max) { node* p; if (head == NULL) { return(1); } else { p = head; max = p-> item; while(p != … | |
[code=c] #include <stdio.h> int main (void) { float a; a = 7/3; printf ("%f\n", a); } [/code] Result : 2.000000 Why is gcc compiler printing 0 after decimal? | |
This is what the question is stating: Write a program that inputs a line of text using function fgets() into a char array s[90], then it outputs the line converted to uppercase. For function [ICODE]fgets[/ICODE] to be used, am i correct if I understand that the user doesn't have to … | |
[CODE]#include <stdio.h> int fill_array(void); int display_array(int count); typedef struct { char worker_name[20]; float hourly_pay; int hours; }WorkerRecord; int main() { WorkerRecord info[50]; int count, k; float average_wage; count = fill_array(); display_array(count); for(k = 0, average_wage = 0; k < count; k++) { average_wage += info[k].hourly_pay; } average_wage /= count; printf("\nAverage … | |
Consider there is a string [COLOR="Red"]"hai welcome..."[/COLOR] I need to [COLOR="red"]print the string [/COLOR]as such [COLOR="red"]leaving the first three characters..[/COLOR] I should not use in-built functions or others... It should b [COLOR="red"]done in a single printf statement [/COLOR]by [COLOR="red"]changing the control string pattern..[/COLOR] | |
[CODE]#include<stdio.h> int fun(); /* function prototype */ int main() { int (*p)() = fun; (*p)(); return 0; } int fun() { printf("WEB\n"); return 0; } [/CODE] this program is working fine and printing WEB as well int (*p)() = fun; how these two consecutive lines of codes are working please … | |
Hi! I want to read integers from a string of integers and store the individual integers in an array. The problem is that I don't know how many integers in the string would be otherwise I would have used sscanf with a format specifier. For example: Input: 10 20 12 … | |
I just have a quick question, I tried to figure this out from my textbook but can't seem to find it. j = 5, i =7 Evaluate (++j == i) + 3 How does C evaluate the expression? To me, it just doesn't make sense. I'm not looking for the … | |
[CODE] httpRequest parseHttpRqt(char *msg) { httpRequest rtrn; return rtrn; } [/CODE] I was just wondering if anybody could help with parsing a Http Request? I understand that the request is as illustrated below, but how would i turn that into an object containing the code (200/400/404) and the filename? Bearing … | |
Hello, I want to use Hamming Code to correct any BER's that I have streaming from a text file. The contents of my text file are as follows: 0 0 1 0 1 1 0 0 0 1 0 1 1 1 1 1 1 0 0 0 0 1 … | |
I've looked on the site and I've Google'd this for the past couple days to no avail. Either this is just completely obvious and I'm terrible at programming(I'm new, so this is possible). Anyway, the assignment is to accept two whole numbers that are 512 digits or less. Then we … | |
| Hello people I have a 2 dimension array that contains only 0 and 1 values. I want to represent all the 0 elements in a tree: how can I do that ? Thank you for any help |
Hey i am wondering if it is possible to have a switch statement in a function that is leading to another switch statement and another switch statement afterwards. Question. Write a program that will give the user the option to select a shape or a three dimensional object. The program … | |
Hi. I need to develop a C source code that accept all marks and counts the total percentage of the subject "STIV1013". And, based on the total percent obtained, I need to determine the grade acquired for the subject "STIV1013" based on the grade table given. Look below, for a … | |
i wrote a program that needs to act like the SHELL in linux everytime the user enters a command the shell needs to get it and do the action by sending a fork child to do so now i read using FGETS and get a char array containing the command … | |
Write a program that creates a two dimension matrix of size N x N (N is larger than 4). Through a menu, the user can choose to perform the following operation to the matrix. 1 - Rotate the matrix around the diagonal (function name rotateDiagonal) Example for 3 x 3 … | |
I have an assignment to make a craps game in c. The program i wrote runs but it always ends before it should. I think that the while loops in main have a problem but im not exactly sure wat the problem is because ive reviewed this code over and … | |
Assalam U Alaikum Guys! can somebody help me how to convert a string to Char array? like if m having a string=("hello"); and i want to convert it to arr[5]={'h','e','l','l','o'}; is that possible.. or can somebody help me? | |
Hi everyone. My assignment this time requires me to: [B]1.[/B] List down the marks obtained for each 5 Quizzes. [B]2.[/B] Choose the best 2 highest marks out of the 5 Quizzes. [B]3.[/B] To make the "best 2 highest marks" becomes the ultimate Quizzes total mark which has a 10% carrying … | |
I'm working on a project and i'm having a bit of trouble. the basic idea is to make an employee database using a basic structure. the program is to have 3 files and in the header file the professor wants the function prototype to be: [CODE]int addEmployee (struct employee *, … | |
The program should simulate rolling of 2 dice and add the sum of the 2 dice after they are rolled for 3600 times. Their sum ranges from 2-12. The frequency should be tallied in this order for eg when sum =2 freq =.. when sum =3 freq =.. etc This … | |
I've got a project that requires the user to input a capacitor's ID and its corresponding capacitance. The user can add the capacitor at the beginning or end of the list. But, I'm having trouble figuring out how to put it at the end of the list. [CODE] while( currentPtr … | |
hello....i am trying to read a some integers with spaces in a file into an array, say the integers in a text file are in the shown way 1 2 3 5 13 34 2 122 2 1 34 34 23 343 53 so now i wish to read them … | |
I have to create a program in C and not C++, that allows the user to create a file that stores names and numbers, displays them and sorts the dates by names or numbers using Bubble sorting. I know how to create a program that sorts names and numbers that … | |
will anyone please give me the basic structure to traverse the graph? i knoe the algo but i want to knoe the way that how to proceed? some idea about that. thanks | |
im getting the error below and I can't figure out why this isn't working. Ive looked at this for 2 days not knowing. I'm hoping a fresh set of eyes on it might help. main.c:13: warning: assignment makes pointer from integer without a cast [CODE] //HEADER FILE: #include <stdlib.h> #include … | |
I am currently writing a Client and server program and I have no idea where when wrong with the write function It calls the function [CODE] writeToclient (int clientFd) { tatic char* win = "you win !"; write (cliendFD , win , strlen(win)+1) ; printf("test"); } [/CODE] it execute the … | |
I'm having problems with my code all over. I have to be able to open a command line argument( which i know how to do). create a linked list, and print it backwards. This is what i have but im stuck with errors that i don't know how to fix. … | |
[CODE] #include<stdio.h> #include<conio.h> void main() { int i[15],n,q,j; clrscr(); printf("Enter the value of N:"); scanf("%d",&n);//an unsigned value printf("\nBinary Val of %d=",n); q=n;//initialize quotient to n for(j=0;j<16;j++) i[j]=0;//initialize binary vector to zero //calculate the binary Equivalent j=15;//store the Remainder in reverse order if(q!=0) { while(q!=1) { if(j>=0) i[j]=q%2; j--; q=q/2; } … | |
Hello All i am trying to compile a simple code for the strtok but getting the error as segmentation fault ( core dumped ) .. any help would be appreciated. [CODE] #include <stdio.h> #include <netinet/in.h> #include <stdlib.h> #include <string.h> main() { char *test="asim.nazeer.helo.me"; char *rsl=strtok(test,"."); //while(1) //{ printf("%s",rsl); //} } … |
The End.