15,550 Topics

Member Avatar for
Member Avatar for Rupindersingh

The following program is supposed to sort eight strings in alphabetical order, but its not functioning properly. Can anyone please debug this [CODE]void main() { char *p[8], *s; int i,j,t; clrscr(); printf("Enter the strings:\n"); for(i=0;i<8;i++) gets(p[i]); for(i=0;i<8;i++) { for(j=i+1;j<8;j++) { t=strcmp(p[i],p[j]); if(t>0) { s=p[i]; p[i]=p[j]; p[j]=s; } } } printf("\nSorted …

Member Avatar for Rupindersingh
0
112
Member Avatar for shamusk

Hi everyone, i need to generate random numbers between two values a & b, where both a and b less than 1. Example a random number between a = 0.60 and b = 0.69. what i am trying to do is in C program temp_ins = a + (drand48())*(b - …

Member Avatar for shamusk
0
177
Member Avatar for shanker31

Hello every1 My name as you know is displayed out.I am a CS student and we have mini-project assigned to every1 in my class. I have finished around 50% of my project.I need help.. My question: I want to take input from the web page,do the calculation in background (in …

Member Avatar for Ancient Dragon
0
144
Member Avatar for sharma89bunty

Hello sir, Good afternoon! i am happy to get the help from you. for that thanku very much. but now i need help in the for loop. * * * * * * * * * * * * * * * here is the picture, i want the coding …

Member Avatar for Ancient Dragon
0
95
Member Avatar for sydsine

plz explain these function. how can w divide a number by 3 using only atoi function.

Member Avatar for cse.avinash
0
451
Member Avatar for techie929

Hi, I dont know why I am getting segmentation fault when adding the line 'int n' [CODE] #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]) { char* pStr; // no memory allocation int n; printf("enter a string\n"); fgets(pStr,20,stdin); printf("\nvalue of string is %s\n",pStr); while(*pStr!='\0') { printf("value of …

Member Avatar for techie929
0
107
Member Avatar for Master Mascus

Hey guys i got a question to solve, can anyone help me out.. Write a C interactive program that will encode a word or sentence entered by a user. The encryption will be done as follows: For any word or sentence (note: blank spaces, special characters are ignored here, i.e …

Member Avatar for Master Mascus
0
166
Member Avatar for thamilalagan

[CODE]struct NUMBERS { char name[MAXCHARS]; struct NUMBERS *value; };[/CODE] i am new to programming ...can anyone explain this for me ?

Member Avatar for cse.avinash
0
81
Member Avatar for D.M.

I need help! In this program, if you hit the ENTER KEY the program will display the word "newline". If you hit the SPACE BAR it will display the word "spacebar". But unfortunately, the second statement did'nt worked (SPACE BAR). help me.... [CODE]#include<stdio.h> main() { char n; scanf("%c",&n); if(n='\n') printf("newline.."); …

Member Avatar for Narue
0
105
Member Avatar for sunny124

Hi, I created a previous thread of re-sizing dynamic arrays. I got the answers to that question and I could re-size the dynamic arrays but when I tried to apply similar steps to creating a dynamic array of struct, my program compiles but crashes when i try to run it. …

Member Avatar for Narue
0
184
Member Avatar for murnesty

I'm currently choosing which data structure to use for my data logging. Just want to ask for suggestion which type of data structure is better. It has limitation on memory either store in microcontroller RAM or SD card. - I can't know the total type of logging it has. (for …

Member Avatar for Narue
0
154
Member Avatar for chiiqui

Guys help me please, the equation on 2/3 is giving the waterTemp to 0; how come it is not changing? and also, if the nWaterTemp reached 20.00or somewhere 20.00 to 21.00; it is supposed to print that "THe kettle is now on "Help please [CODE]#include<stdio.h> #include<stdlib.h> #include<cstdlib> #include<time.h> void wait …

Member Avatar for Moschops
0
249
Member Avatar for ROCK_ST@R

[CODE]#include<stdio.h> #include<stdio.h> #include<stdlib.h> struct bst { struct bst *left; int info; struct bst *right; }; struct bst root; void create(struct bst*,int); void preorder(struct bst*); void postorder(struct bst*); void del_leaf(); void del_singlechild(): void main() { struct bst *p; int n,c; char ch; root=(struct bst*)malloc(sizeof(struct bst)); printf("\nenter the info:"); scanf("%d",&root->info); root->left=root->right=NULL; do …

Member Avatar for D33wakar
0
226
Member Avatar for fullarmorzz

We are asked to input 10 integers where in we need to display: 1. The sum of all the odd numbers 2. The sum of all the even numbers I do not know how to make a statement and i do not know whether to use for or while and …

Member Avatar for ashok1514
0
197
Member Avatar for resell4
Member Avatar for sunny124

Hi, When i use realloc to re-size my array it is re-sizing it correctly but my some of my data is getting lost. Strange thing is that If I don't use realloc, I can still re-size my array by just increasing the index before inserting the data. In this case …

Member Avatar for Ancient Dragon
0
114
Member Avatar for daveoffy

I am working on a "searching" program. But it always returns a "." as the up directory or whatever. And I can't do an if statement to check if its a period or not. The goal is to get the only name of the folder in that directory. There is …

Member Avatar for MonsieurPointer
0
302
Member Avatar for NTxC

Hello, I need to write code which detects whether keystrokes are injected by applications (with SendInput, keybd_event) or are genuinely coming from the keyboard. I came across a possible solution: creating a WH_KEYBOARD_LL hook and checking the INJECTED flag. So I've made this so far: [CODE] HHOOK g_hHook; LRESULT CALLBACK …

Member Avatar for MonsieurPointer
0
436
Member Avatar for jayesh.rocks

Write a C program to read Roll number,Name and Marks of 3 subjects of a student using structure

Member Avatar for MonsieurPointer
-5
151
Member Avatar for muratgul

hi, u are so good at c, i saw some program that i looked for, but i dont look at result, i need a program, for beginner level of c programming (because i am beginner), converting binary to gray, gray to binary i only know while, if, for, a little …

0
48
Member Avatar for top_coder
Member Avatar for Narue
0
64
Member Avatar for aFg3

I want to create a simple file....with the command Example: [CODE]touch file.txt[/CODE] ok its created *BUT* ****I want to edit this file in shell and save it, writing EOF to finish. Any suggestions? How i do that? Thanks!

Member Avatar for aFg3
0
132
Member Avatar for D.M.

I have a program that reads the data from a stream. Let's just pretend that I already made file in C:\ (record.txt) and I wrote the following words: hello world me you But the program will display in this manner: hello world me you instead of: hello world me you …

Member Avatar for D.M.
-1
75
Member Avatar for dimmu11

I'm stuck on this function that is related to the game of life. It is supposed to randomly populate the game board with '*'s based on the user input (what percentage they want to be '*'). this is what I have so far, but it crashes when I try to …

Member Avatar for WaltP
0
131
Member Avatar for mdegges

Hi everyone, I'm trying to store user input into an array. The output looks like this: Enter the size of the arrays: 5 Enter the cells of array1: 1 2 3 4 5 Enter the cells of array2: 5 4 3 2 1 This is my code so far: [CODE] …

Member Avatar for mdegges
0
8K
Member Avatar for Aman6o

I need help understanding the increment operator and the output of this program. I am confused with the output of 'i' and 'm' According to me: i = 4 and m = 20 but, that is not what you get when you compile. Please explain. Thanks in advance. [CODE]#include <stdio.h> …

Member Avatar for Narue
1
143
Member Avatar for bizcat

Hello! I am fairly new to C, and trying to learn to deal with malloc. The objective for the code, is to allocate memory in order to store a string on the heap. Compiler says "Warning: assignment makes integer from pointer without a cast" "Warning: format '%s' expects type 'char …

Member Avatar for gerard4143
0
179
Member Avatar for Ich bin würdig
Member Avatar for Narue
0
170
Member Avatar for xxmp

Hello I have to function void lala_a(adktis *p) void lala_k(kdktis *p) These two functions are doing the same things but i want to make one function tha can accept adktis/kdktis something like this void lala(adktis *p); void lala(kdktis *p); Is there a way to do this in c? Thank you …

Member Avatar for xxmp
0
127
Member Avatar for sucram

Hi everyone! I`m new here in daniweb. Our Prof. want us to make a game w/ a menu. I already made the game but my main menu is the problem. how to make a menu that after the game it will ask. Do you want to try again >>> then …

Member Avatar for Narue
0
158

The End.