15,540 Topics

Member Avatar for
Member Avatar for prettyann

Hi. I have a bit of a problem with this code: [CODE] #include <stdio.h> #include <conio.h> #include <stdlib.h> main () { FILE *data; char let; int prior, ctr; data = fopen("huffman_table.txt", "r"); while (fscanf(data, "%c%d\n",&let, &prior)!='\0') { printf("\nLetter: %c Priority: %d", let, prior); } fclose(data); getche(); } [/CODE] The huffman_table.txt …

Member Avatar for jephthah
1
140
Member Avatar for max.v8

Hello guys, this is my first time in these forums, so I apologize for my bad English. Well, here's the problem: I need to get the frequency of integer numbers that are stored in a file, their range is from 0 to 100, their amount is unknown and depends on …

Member Avatar for max.v8
0
164
Member Avatar for whatThewhat

I really need some help implementing counters. I have to count the suits and faces drawn from the deck but for some reason all outputs is junk numbers. Am I missing something? I what it to come out something like this: Say a player is dealt: Ace of Hearts Ten …

Member Avatar for whatThewhat
0
117
Member Avatar for HeavySoul

Hi people, my first post here, hope its a good one. I am trying to develop a program which will simulate a very simple name server, using the client-server frame. My problem appears after the server receives the data (in form of a string) from the client and tries to …

Member Avatar for girishn
1
133
Member Avatar for doom5

I'm teaching myself C, and wrote this string reverse function. I cannot figure out why it is crashing... [code=c]#include <stdio.h> void ReverseString(char *inStr, int length); void ReverseString(char *inStr, int length) { char temp; int j=length; int i=0; while( i != j) { temp = *(inStr+i); *(inStr+i) = *(inStr+j); *(inStr+j) = …

Member Avatar for girishn
1
139
Member Avatar for bhanukarumudi

it is not complete.........u may need to do some modifications Regards, Bhanu[code]#include<stdio.h> #include<pthread.h> #include<signal.h> struct lift { int status; int movement; }l[8]; struct floorno { int curfloor; int destfloor; }f[8]; int i; void main() { int ch; int j; for (j=0;j<8;j++) { l[j].status=0; l[j].movement=0; } pthread_t lift[8]; j=0; while(1) { …

Member Avatar for Ancient Dragon
-1
102
Member Avatar for infrapt

Hi I am trying to malloc align each location of an array to 128 bits. I am using the method malloc_align in linux to align arrays and so on. But in this case I want to align each position of an array to 128 bits for(i=0;i<size;i++){ //N=7 2^N=128 array[i]=malloc_align(sizeof(double),7) ; …

Member Avatar for Ancient Dragon
0
103
Member Avatar for prade

hi, i i recently installed dev c++ 4.9.9.2 ....the first hello world program i wrote gave me some insane messages when i compiled & the exe files which gets created...my antivirus detects them as trojan flies & deletes them....i tired & re -installed dev again but it didnt help...please help …

Member Avatar for gerard4143
0
163
Member Avatar for yasokrish

Hi,am newbie to c programming.can u explain the above c program which reads a file more than its capcity.. i couldn understand more than this.. Thanks,Yasokrish.[code]#include <stdlib.h> #include <stdio.h> #include <string.h> int bof(FILE *badfile) { char buffer[12]; fread(buffer, sizeof(char), 40, badfile); return 1; } int main(int argc, char **argv) { …

Member Avatar for muditAggarwal
0
159
Member Avatar for karthiken07

I need to write some contents in the text file (notepad), with some specified font, and size .is it possible in C, kindly let me know.

Member Avatar for Ancient Dragon
0
145
Member Avatar for shahab.burki

I have problems in decrypting the text using AES in C. the code is belwo. [CODE]#include <stdlib.h> #include <openssl/evp.h> #include <string.h> int main(){ //declaring the variables char source[6]="Shahab"; char target[6]; char output[6]; char mykey[EVP_MAX_KEY_LENGTH]="hardtobreak"; char iv[EVP_MAX_IV_LENGTH] = "an_iv"; int in_len, out_len=0; int check; EVP_CIPHER_CTX ctx; in_len=strlen(source); printf("This is the text …

Member Avatar for jephthah
0
114
Member Avatar for Vytautas

Hey, guys, to begin with, I'm a complete newbie to C and I'm writing a Knight Tour program. The idea of my program is to check every possible way (it is necessary for the assignment), so I start with x + 1 & y + 2 and so on. If …

Member Avatar for jephthah
0
1K
Member Avatar for Xufyan

Hello using conditional operators I want to make a program that ask user to input three values and print the maximum among those three values. i have done for two values but dont know the logic for three values. [CODE] int main(void) { int a,b,c,d; printf ("first value"); scanf ("%d",&a); …

Member Avatar for jephthah
0
140
Member Avatar for Xufyan

How can i convert this pr0gram in conditi0nal operat0rs...? I don't kn0w h0w to use more than tw0 conditi0ns in c0nditi0nal 0perat0rs. We've learned to use two conditional operators conditions s0 far, for example, [iCODE] (a>b)? a:b ; [/iCODE] but don't kn0w how t0 apply it for 3 c0nditions ? …

Member Avatar for jephthah
-2
163
Member Avatar for shamly
Member Avatar for raigs

The prototype for setsockopt is: [CODE]int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len);[/CODE] Are the following all correct ? Which are not ? [CODE]int buffsize = 50000; setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&buffsize, sizeof(buffsize));[/CODE] [CODE]int buffsize = 50000; setsockopt(s, SOL_SOCKET, SO_RCVBUF, (void *)&buffsize, sizeof(buffsize));[/CODE] [CODE]char *buffsize = …

-1
119
Member Avatar for ilkeamasya

For example i have an array like: a[20]={1,5,7,8,4,3,12,15,15,15,11,...} lets say that the max Value of this array is 15. i want to write : "The max value of array a is 15 and it is located at 8th,9th and 10th element in array. " Is it possible to write a …

Member Avatar for Banfa
0
112
Member Avatar for jephthah

i know the general answer to using [ICODE]goto[/ICODE] is always "No!". I understand why, especially when teaching basics to new programmers, because it can lead to very bad practices and horrible spaghetti code. but ... when i write certain hardware drivers, i have to immediately cease executing a function if …

Member Avatar for nezachem
0
134
Member Avatar for shahab.burki

I am doing some AES encryption using C. But the errors ocurred. The code is following by the error displayed. 1 Code [CODE]#include <stdlib.h> #include <openssl/evp.h> #include <string.h> int main(){ //declaring the variables char source[6]="Shahab"; char target[6]; char mykey[EVP_MAX_KEY_LENGTH]="hardtobreak"; char iv[EVP_MAX_IV_LENGTH] = "an_iv"; int in_len, out_len=0; int check; EVP_CIPHER_CTX ctx; …

Member Avatar for shahab.burki
0
255
Member Avatar for MWE_QUE

Thanks for any help. Most of this works, but I get a compiler error on lines 60, 84, and 105, where it says [CODE] current = currentStore->link [/CODE] The error reads "assignment from incompatible pointer type" It runs, but in the printStores function when i gets incremented on line 81 …

Member Avatar for MWE_QUE
0
105
Member Avatar for deeer

hi how do I put words into a specified location of a 2d array using scanf? string movies[100][6]={}; in main i need at least 100 rows and 5 columns i want the user to enter the movie id, name year, type and availability it will be stored in a 2d …

Member Avatar for deeer
0
747
Member Avatar for serious01
Member Avatar for jephthah
0
96
Member Avatar for jsp133100

I'm trying to write code for finding the number of same number in array. For example, in [1, 2, 3, 3, 4], the number of same number is 2. In [1, 2, 1, 3, 1], the number of same number is 3. How can I implement this? Please, help me.

Member Avatar for Software guy
0
109
Member Avatar for lionaneesh

[CODE]#include<stdio.h> #include<string.h> #define count 2000000 void add(char word[],char meaning[]) { FILE *fp; fp = fopen("words.txt","a"); fprintf(fp,"%s = %s\n",word,meaning); } void processing(void) { int i = 0,delay; printf("Processing....\n\n"); for(delay=0;delay<count;delay++) ; printf("\n"); } void getwords(void) { FILE *fp; fp = fopen("words.txt","r"); if(fp!=NULL) { printf("\n/**************************** DICITIONARY **********************************/\n\n\n"); char words; while((words = fgetc(fp)) != …

Member Avatar for nezachem
0
154
Member Avatar for AngusFloydKAOS

Hey so I'm trying to get one of my c variables to be a bash variable. Is there a way that I can do this?

Member Avatar for nezachem
0
107
Member Avatar for lionaneesh

I want to know what is const type in C and what is its uses etc. i dont know anything about this term used in C so please give detailed description...

Member Avatar for jephthah
0
117
Member Avatar for lyn.vita

Hi all, I'm trying to write the Hufmann code to encode a given file & give me the compression ratio. but when I run this programme, I'm getting segmentation fault. Can you please help me with correcting it ? [CODE] /*************************/ /*************************/ // HUFMANN.C /*************************/ /*************************/ #include<stdio.h> #include<stdlib.h> #include<input.h> #define …

Member Avatar for Adak
0
138
Member Avatar for jacksparao
Member Avatar for lionaneesh

[CODE]#include<stdio.h> #define SQR(x) x * x int main() { printf("%d", 225/SQR(15)); }[/CODE] why this program outputs 225 instead of 1 (according to calculation).

Member Avatar for aman rathi
-1
210
Member Avatar for jasneg16

im using <stdio.h> and <conio.h> only is there any solution so I can randomize result? I want to make a fortune cookie that randomize the reading. i am not familiar with iostream and stdlib thanks

Member Avatar for WaltP
0
142

The End.