15,551 Topics
| |
I have written one small program to check whether particular bit is set or not. But not getting proper value when i check for upper nibble. #define check(var,pos) ((var)&(1<<pos)) void main() { int var=30;// in binary 0011 0000 that is its 4th and 5th bits are set; int bit; printf("enter … | |
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 … | |
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() { … | |
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 … | |
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 | |
(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 … | |
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 … | |
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> … | |
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 … | |
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 … | |
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 … | |
| 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 … |
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 … | |
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] … | |
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 = … | |
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 … | |
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 … | |
` 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 = … | |
#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 … | |
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 … | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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; … | |
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 … | |
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 … | |
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. … | |
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 … |
The End.