15,550 Topics

Member Avatar for
Member Avatar for Enders_Game

Pretty self explanatory code. Why doesn't it work! #include <stdio.h> int main() { __asm__("number dw 0"); // declare number? printf("%d",number); __asm__("mov %eax,number" "inc %eax" "mov number,%eax"); printf("%d",number); return 0; } cc ex1.c -o ex1 ex1.c: In function ‘main’: ex1.c:22:17: error: ‘number’ undeclared (first use in this function) ex1.c:22:17: note: each …

Member Avatar for Enders_Game
0
279
Member Avatar for ntggl19

hello everyone i'm new ic and i have a problem on structs, on the very simple i want to create a struct with one int and a char table 3 potisions,this is my code #include <stdio.h> #include <string.h> #include <conio.h> struct domi { int code; char name[3]; }; main() { …

Member Avatar for ntggl19
0
198
Member Avatar for nitin1

hello, Can anyone please tell me the most efficient know till date so as to find the prime numbers up to 10^8 or higher. I am using sieve and using odd number optimization with it also. but it is not too much effiecent which i want. Can you please any …

Member Avatar for Adak
0
109
Member Avatar for pooja.singh.3950

can any1 give me flowchart and algorithm for 1) counting positive numbers from a given set 2) gcd and lcm of two numbers 3) smallest positive divisor of an integer other than 1 so from above i would be able to make program on my own

Member Avatar for Adak
0
112
Member Avatar for Twilitbeing

(I'm a Computer Science 101 student writing programs in C on a virtual Linux machine.) Suppose I wanted to apply a single (arbitrary) function to every element of an array, one at a time. Doing this once is easy enough, but I'd like to find a method that could accomplish …

Member Avatar for dmanw100
0
267
Member Avatar for ThomsonGB

I have been using the Jove editor by Jonathan Payne for many years. If You are not familiar with Jove - Jove stands for Jonathans own version of EMACS. I love using it. In the 80s I had my own version of jove with a lot of my own personal …

Member Avatar for ThomsonGB
0
340
Member Avatar for saamsonn

I'm trying to write a code to take an image as argv[1] and save it in a new file "argv[2]" with the image flipped upside down, but my output does not open with any image viewer here's my full code. some one help me out please #include <stdio.h> #include <string.h> …

Member Avatar for BobS0327
0
3K
Member Avatar for jcmoney1010

I'm trying to search a string array of names and return an integer to the main depending on if the search was successful or not. for example if the user entered name didn't exist it would return -1 and I can tell the user the name is not listed, but …

Member Avatar for Adak
0
180
Member Avatar for jcmoney1010

I'm writing a program that is supposed to take in a list of names from the user, store them in an array, and then search through the list to check and see if the next name the user enters is part of the original list of names. The issue I'm …

Member Avatar for jcmoney1010
0
161
Member Avatar for nitin1

what are they trying to say in this paragraph , I have read it 10 times, but not getting what they want to teach me here: link is this. : http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=primeNumbers and the para which is just before the euler totient theorem. am copying here also. *Or consider a scenario …

0
84
Member Avatar for chipbu

Hi guys, here I have a code snippet that I tried to run for 2 days without any result. There is something wrong with fread function. When debugging, it doesn't read all the file that I need Here is the link to the file http://www.math.umbc.edu/~rouben/2003-09-math625/images/reese_witherspoon.pgm In main: #include <stdio.h> #include …

Member Avatar for BobS0327
0
269
Member Avatar for bemo55

I have a project for school that i am working on, and i cant figure out how to store names in an array. i have it declared as [code] char firstname[25]; char lastname[25]; [/code] but i was told that just stored one string and when i go to print out …

Member Avatar for jcmoney1010
0
9K
Member Avatar for berwick53

Hi I'm having problems with the code in that everytime it iterates it replaces all the values of SendBack with the newly read in values from fgets! FILE *fp; char FileLoc[] = "123456-12345678.txt"; char *SendBack[10]; fp = fopen(FileLoc, "r"); if (fp != NULL) { int x=0; while (fgets(BUFFER,20,fp)) { SendBack[x] …

Member Avatar for Ancient Dragon
0
132
Member Avatar for goyofoyo

how would one manipulate the code below, using pointers? int add(int a, int b) { int result=0; int s=0, c=0; /* result and carry; carry in for bit 0 is 0 */ /*int bit_a, bit_b; int i, n, mag=0; for(i=0; i<16; i++) { bit_a = ((mask_array[i] & a)?1:0); bit_b = …

Member Avatar for Ancient Dragon
0
94
Member Avatar for dancks

code snippet: void checkcollision() { float x1 = tanks[0].x; float y1 = tanks[0].y; float x2 = tanks[1].x; float y2 = tanks[1].y; float dist = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)); float dr = tanks[0].rad+tanks[1].rad; if(dist<dr); { printf("checkcollision read true\n"); printf("dist: %f, radius+radius: %f\n",dist,dr); goback(0); goback(1); } } output: checkcollision read true dist:363.159302, radius+radius:14.142136 …

Member Avatar for dancks
0
117
Member Avatar for sarah.mathieson.7

Hi, I have a counter that I am using in my main and increasing through pointers in other functions. I want to be able to use the value of this counter in a loop but... I can't. I am getting a warning when I compile saying that I am trying …

Member Avatar for deceptikon
0
244
Member Avatar for harishjoy

` LONG APIENTRY Esl_CheckCMTClassRecord(struct CMT_Class_Record *ClassRecord, long *ret) { USHORT uResult; SHORT retcode; uResult = bt3Start(Class.CMT_fd,Class.CMT_data); if(uResult == CLASS_RECORDLENGTH ) { memcpy(Class.CMT_data, ClassRecord , CLASS_RECORDLENGTH); retcode = bt3FindRel(Class.CMT_fd, Class.CMT_data, FR_EQUAL); // Read CMT record if(retcode > 0) // read successful { *ret = 1; return(0); } else { *ret = …

Member Avatar for harishjoy
0
249
Member Avatar for prathiyus

#include<stdio.h> #include<stdlib.h> int main() { int **a,r,c,i,j,; printf("\n enter the size of row"); scanf("%d",&r); printf("\n Enter the size of col"); scanf("%d",&c); //allocating memory a = (int**)malloc (r*sizeof(int*)); for(i = 0;i<r;i++) a[i] = (int*)malloc(c*sizeof(int)); //array elements for(i = 0;i<r;i++) for(j = 0j<c;j++) scanf("%d",&a[i][j]); -------- --------- how to fill the array with …

Member Avatar for Ancient Dragon
0
284
Member Avatar for harishjoy

Hi i am totally new to C and have a doubt on which one is correct below. LIBRARY PWHDENDT InitInstance DESCRIPTION 'PWS Endt Array Functions' ;DATA and CODEare not supported in windows ;DATA PRELOAD MULTIPLE NONSHARED ;CODE PRELOAD SHARED or LIBRARY PWHDENDT ;InitInstance DESCRIPTION 'PWS Endt Array Functions' ;DATA and …

Member Avatar for harishjoy
0
114
Member Avatar for lscamaro

Now, before everyone says anything, I know that goto statements are never needed. Having said that, I was given an assignment to implement them into a sort of some type. I was assigned selection sort and figured that if I wrote the sort without go to's, it would be easier …

Member Avatar for Ancient Dragon
0
138
Member Avatar for dancks

Ok. As the title says I tried many times to simply write a program that rewrites a file to remove null characters. I confirmed with a hex editor that the file in question has tons on null characters, on average about 1 of every 2 characters in null. So my …

Member Avatar for dancks
0
427
Member Avatar for Allahwahid

How we can write a program to get out put given below in c?? 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 4 5 4 3 2 1

Member Avatar for deceptikon
0
176
Member Avatar for praneeth_gunda

Hi EveryBody,This is the Code I have written for Simplified DES it is delivering the Cipher of 16-bit size actually it should deliver of size 8 Please help me in solving the Problem and even tell me how 2 reduce the Complexity [code] #include<string.h> char ep[8],p10[10],p8[8],ip[8],ip1[8],pr[10],key1[8],key2[8],p4[4]; int s0[4][4]={{1,0,3,2},{3,2,1,0},{0,2,1,3},{3,1,3,2}} ,s1[4][4]={{0,1,2,3},{2,0,1,3},{3,0,1,0},{2,1,0,3}}; void …

Member Avatar for elava
0
496
Member Avatar for RAPTOR88

Hey all. I'm fairly new to programming and I just have a little issue. I have a code that will read in a string of character and outut weather the character are alphabetical or not but i also need to use a counter to count how many time each character …

Member Avatar for Gonbe
0
146
Member Avatar for jdh1231

From the code below, how can I display what elements each processor have? Can someone show me how to do it? I ran it with mpicc -o scatter scatter.c mpirun -np 4 scatter #include <stdio.h> #include <stdlib.h> #include <mpi.h> #define root 0 int main(int argc,char *argv[]) { int rank, p; …

0
67
Member Avatar for pardeep3dec

Dear Experts,can we make dll in turbo c and use that dll in vb 6.0. Actually i have a program in c and it has so many constant 3 dimensional array.I have to use some API which can not be used in turbo c so i am planning to make …

Member Avatar for Schol-R-LEA
0
281
Member Avatar for mahnaz0098

Hello when i use below program to write and read data from USB mass storage device(flash memory) i am getting following error. I've succeeded with usb_bulk_write() but can't utilize usb_bulk_read(). It returns an error. Set configuration usb_bulk_write: 12 bytes written 33 5b 2 1 0 5 1 3 7 f …

0
106
Member Avatar for Carc369

Basically I'm trying to see if the first letter is in the dictionary... then if it is.. check if the first and second letter are in the dictionary.. and if it is... check if the first, second, and third letter are in the dictionary... and so on and so forth. …

Member Avatar for Banfa
0
264
Member Avatar for ali11

how can i replace the array notation with pointer notation #include<stdio.h> #include<stdlib.h> #include <math.h> /* 4 */ void run_sieve(char *, int); /* 5 */ void print_primes(char *, int); /* 6 */ int main() { /* 7 */ int i, top; /* 8 */ printf("compute primes up to: "); /* 9 …

Member Avatar for -[xxxxxxx]-
0
247
Member Avatar for jake.jackson.7169709

I'm still a little confused. Basically this is what I'm trying to do, and I'm having one hell of a time with it... My program has two values "Value" and "N". The goal of the program is to select every Nth number of Value starting with the last, and print …

Member Avatar for dx9_programmer
0
209

The End.