15,552 Topics

Member Avatar for
Member Avatar for mridul.ahuja
Member Avatar for mridul.ahuja
0
4K
Member Avatar for iacosar

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 != …

Member Avatar for iacosar
0
157
Member Avatar for lastbencher

[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?

Member Avatar for mridul.ahuja
0
145
Member Avatar for terence193

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 …

Member Avatar for WaltP
0
189
Member Avatar for MrJewbagel

[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 …

Member Avatar for MrJewbagel
0
93
Member Avatar for vani krishnan

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]

Member Avatar for vani krishnan
0
141
Member Avatar for mohan_saini

[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 …

Member Avatar for Narue
0
135
Member Avatar for alphahuman

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 …

Member Avatar for Narue
0
1K
Member Avatar for gizmo7008

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 …

0
51
Member Avatar for purpleturtle_97

[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 …

Member Avatar for Adak
0
262
Member Avatar for kgal

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 …

Member Avatar for Adak
0
164
Member Avatar for Nekawa

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 …

Member Avatar for Nekawa
0
2K
Member Avatar for begueradj

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

Member Avatar for begueradj
0
95
Member Avatar for Liuhh00

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 …

Member Avatar for Liuhh00
0
1K
Member Avatar for UNDER-18 FG

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 …

Member Avatar for Adak
0
159
Member Avatar for Despairy

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 …

0
101
Member Avatar for mr_maverix

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 …

Member Avatar for mridul.ahuja
-1
303
Member Avatar for IcyFire

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 …

Member Avatar for IcyFire
0
2K
Member Avatar for f4fjks

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?

Member Avatar for WaltP
0
78
Member Avatar for UNDER-18 FG

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 …

Member Avatar for WaltP
0
87
Member Avatar for Mindless Z

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 *, …

Member Avatar for Mindless Z
0
153
Member Avatar for terence193

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 …

Member Avatar for terence193
0
130
Member Avatar for DmytriE

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 …

Member Avatar for Ancient Dragon
0
125
Member Avatar for ooops.789

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 …

Member Avatar for Narue
0
7K
Member Avatar for JohnQ002

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 …

Member Avatar for JohnQ002
0
1K
Member Avatar for gourav1

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

0
47
Member Avatar for dgreene1210

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 …

Member Avatar for Ancient Dragon
0
713
Member Avatar for ricedragon

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 …

0
78
Member Avatar for dgreene1210

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. …

Member Avatar for dgreene1210
0
188
Member Avatar for dmanjunath

[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; } …

Member Avatar for WaltP
0
160

The End.