15,551 Topics

Member Avatar for
Member Avatar for mical700

I have problem reading file form command line. I am trying to do " abcd: ./rev < numbers", but it gives me an error: ./rev < numbers Usage : ./rev FILENAME Here is the code: #include <stdio.h> #include <stdlib.h> void reverse(FILE * file) { int fscanf_return_value; char x; /* read …

Member Avatar for mical700
0
364
Member Avatar for cupin06

The program i want to code is user will enter 2 ebook title,edition,year and pages.After that must write to binary file and read the binary file again to found the book with the highest pages.The first problem is why i cannot use this statement. printf("Enter ebook title: \n"); scanf("%s",mybook.title[i]); I …

Member Avatar for Ancient Dragon
0
203
Member Avatar for nina.le.92

The goal of my assignment is to create a program that takes a string of words and encodes or decodes the string using a simple substitution cypher. I've gotten a decent amount done but I am stuck at the part where I actually have to encrypt and decrypt using the …

Member Avatar for Banfa
0
266
Member Avatar for Perry31

Hi, I have jpeg image of JFIF type, i want to read jpeg image, decode it and finally i want to display this image in a screen. Could anyone explain me the parsing of jpeg binary data for decoding and encoding? Thanks in advance

Member Avatar for Moschops
0
162
Member Avatar for murnesty

I read a sample code from a development kits. The global array is declared without indicating the array size. I wonder is it safe? Here is the code: #include <stdio.h> // For Used Function printf // UART Buffer char uart0_buf[]; // "sprint" UART[0] Buffer char uart2_buf[]; // "sprint" UART[2] Buffer …

Member Avatar for deceptikon
0
141
Member Avatar for dellat

I have more than one version of berkeleydb installed in my linux box and when I use -ldb to link berkeleydb to my c code I couldn't know which version is linked to. Please tell me which version is used by linker. I can't configure eclipse cdt with berkeley db …

0
70
Member Avatar for terrier_unknown

hy guys can you please tell me what s wrong with the folowing code float a,b,c; printf("input three numbers:\n"); scanf ("%f%f%f",&a,&b,&c); float z=sqrt((1/2)*(pow(a,2.0)+pow(b,2.0)+pow(c,2.0))-(3/4)*pow(a,2.0)); printf("res is %f",z); getch(); return 0;

Member Avatar for terrier_unknown
0
110
Member Avatar for alex910TN

Hey guys, I am trying to implement the following but the compiler is not liking it. What can I do to fix this? Thanks for any help. typedef struct { int ordinalSum; int LexemeCode; Line Info; Node *next; <-- ??? }Node; error # 1 syntax error before "Node"

Member Avatar for cproger
0
249
Member Avatar for anumash

#include<stdio.h> int main(){ char inputs[33]; int i; for(i;i<33;i++) inputs[i]=' '; int ch; for(i=0;(ch=getchar())!=EOF&&i<32&&ch!='\n';i++) {printf("%c",ch); inputs[i]=ch; } inputs[i]='\0'; printf("%s",inputs); return 0; } I am writing a program where the user enters a character and the program stops asking the user for a character when the user enters the Enter key. Enter …

Member Avatar for anumash
0
129
Member Avatar for dij_0983

I'm trying to develop my own simple uptime command (used to show how long the system has been running) like program where I'm gonna use it for our university's OS, (consider the OS already has all the necessary C libraries needed to make system utilities) Could someone give me a …

Member Avatar for dij_0983
0
244
Member Avatar for deceptikon

I was going to post this in a thread, but it turned into something a bit more serious and may be useful as a code snippet. The code shows three files: * menu.h: The header file for the menu library. * menu.c: Implementation of the menu library functions. * main.c: …

Member Avatar for deceptikon
3
580
Member Avatar for HadoukenGr

Hi, i am trying to make a server client application using sockets in C. Server and client compile just fine but they dont seem to connect with each other and i don't understand why (i just started learning about sockets). My OS is SunOs 5.10. This is my server code …

Member Avatar for Mouche
0
257
Member Avatar for srivardhanms

What is the difference between Definition and Declaration of a variable? Am not talking about function, but variable. When I googled, I found these two answers which are quite contradictory! While one says "definition occures once through the program( memory is allocated once ), but the declaration can occur many …

Member Avatar for srivardhanms
0
1K
Member Avatar for daniel.ngugi.980

please help me to write a code which includes a function for calculating the squareroot of a number without using the predefined functions in the function header............

Member Avatar for gregha04756
0
119
Member Avatar for joseph619

i need to use webcamera to take picture to gimp....i need a plugin so plz help me out i dnt know how to connect webamera to gimp...somebody plz come with a code explenation

Member Avatar for joseph619
0
167
Member Avatar for ronnel09_1

#include<stdio.h> #include<conio.h> #include<dos.h> void main() { int minutes,seconds,timeremaining,input=1; char cAns,cAnswer; clrscr(); gotoxy(35,15); printf("Press S to start the game: "); cAns=getche(); if(cAns=='S'||cAns=='s') { clrscr(); printf("\nAre you a human? Y or N: "); scanf(" %c",&cAnswer); timeremaining=input; do { input=timeremaining; minutes=input/60; input=input-(minutes*60); seconds=input; gotoxy(1,1); printf("%02d:%02d",minutes,seconds); timeremaining++; delay(1000); }while(timeremaining<=90); if(timeremaining>=90) { clrscr(); gotoxy(33,12); printf("TIME'S …

Member Avatar for ronnel09_1
0
519
Member Avatar for anumash

I have a very confusing question to ask and it is the difference between array of pointers & pointer to an array. I want to understand this concept very well so please please do help me understand this concept. I'll start with what I have understood about array of pointers. …

Member Avatar for anumash
0
164
Member Avatar for saurabh.mehta.33234

The following code gave error on gcc compiler int main() { extern int a; printf("%d",a); return 0; } static int a=5; But when static is removed from int a then it runs with no errors..Can someone please clear the doubt??

Member Avatar for saurabh.mehta.33234
0
310
Member Avatar for ronnel09_1

I just want to ask if i can run a timer at the same time with my program? It is like a quiz bee, i'm asking questions and there is a specific time to finish answering. Thank you!

Member Avatar for ronnel09_1
0
93
Member Avatar for mical700

I am getting wrong output. My Code is following, in which I have to use function unsigned long powerof2(int n); #include <stdio.h> #include <stdlib.h> #include <math.h> //int powerof2(int n); unsigned long powerof2(int n); int main(void) { printf(" n 2^n\n"); printf("-- ---\n"); for (int n=0; n<65 ;n++) { //printf(" n 2^n\n"); …

Member Avatar for mical700
0
230
Member Avatar for mical700

I am trying to print: 0 1 1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024 11 2048 12 4096 13 8192 14 16384 15 32768 16 65536 17 131072 18 262144 19 524288 20 1048576 21 2097152 22 …

Member Avatar for mical700
0
382
Member Avatar for fedaa91

hi i am trying to read a file and save to array i wrote one and it worked accept it not reading ot line by line, so i wrote another one but i am trying to make it as function when i make function call i get this error read.c:32:13: …

Member Avatar for fedaa91
0
202
Member Avatar for fedaa91

hi i have this small problem in my code which is that when i run the code it enters to the wrong condition i mean in the if clause where i enter "download" it executes the body of the upload even though the first if clause condition meet and the …

Member Avatar for fedaa91
0
150
Member Avatar for cproger

I type in <graphics.h> and "graphics.h" for terminal on my mac and it says fatal error: 'graphics.h' file not found Please help me.

Member Avatar for cproger
0
155
Member Avatar for saurabh.mehta.33234

the foll code when run on gcc compiler gave 12 as output `struct aa{char a:3;int b:30;char c:3;}; printf("%d",sizeof(struct aa));` but when i replace size of c to 2 then it gives 8 why is that so?? sizeof int is 4 and char is 1..

Member Avatar for nullptr
0
108
Member Avatar for write.me

This code calculated the variance to be 9.75. It really is 9.3, what am I doing wrong? static double computeVariance(ref double Variance, params int[] intValues) { int sum = 0; for (int n = 0; n < intValues.Length; n++) { sum += intValues[n]; } double avg = sum / intValues.Length; …

Member Avatar for tinstaafl
0
150
Member Avatar for krutikasharma

There are a 10 words in statement.i want program in 'C' to find out how many words have the same number of letters

Member Avatar for Moschops
0
104
Member Avatar for blindislands

I need to write a right turn code for a micromouse using sensors but I don't know where to start. Can you help me please? This is the algorithm we developed. > // Right turn while sensor 1 is OFF // initialize RTcounter = 0; if (sensor 6 == 0) …

Member Avatar for Adak
0
242
Member Avatar for dendenny01

My Program contains 4 arrays and I want to sort the array in such a way that if one array is sorted the other array should follow it Example: unsorted array name code salary date John 52 6500 15 Suzzy 10 1500 20 Mike 20 1451 16 Sorted array(according to …

Member Avatar for Adak
0
228
Member Avatar for pandu_kvv

Hi friends... I need to write a program in C which will print all the combinations of a string with non-repeating characters. Example: “Say” will have the following: s, a,y, sa, sy, as,sy, ys, ya, asy,sya,ysa and so on. The string length is not known. The string will be a …

Member Avatar for stbuchok
0
205

The End.