15,552 Topics
| |
[CODE=C] #include<stdio.h> #include<conio.h> #include<string.h> //typedef int BOOL; //#define TRUE 1 //#define FALSE 0 int a[3][4]; int Prime(int *x); void input(); void printOut(); void checkPrime(); int Prime(int *x) { int i; for( i=2; i< (int)sqrt(*x); i++ ) { if( *x%i == 0 ) return 0; } return 1; } void input() … | |
[CODE =C] #include "conio.h" #include "stdio.h" #include "math.h" int isPrime(int n) { int i,isTrue=1; for(i=2; i<(int)sqrt(n); i++) if(n%i==0) return 0; else return 1; } int main() { int N; printf("Enter n: "); scanf("%d",&N); if(isPrime(N)) printf("prime"); else printf("Not prime\n"); getch(); return 0; } [/CODE] here is my source code, but when … | |
Hi, I'm trying to create a simple shell in C for Unix. I've been able to do all the parsing of commands and execution, but I'm having a problem with piping. I think the problem is that I'm not hooking into the correct pipe for the input of the second … | |
Is this the proper way to zero the first 12 bits of an address? [CODE] void *ans = (void*)((unsigned long)addr & ((0UL - 1) ^ 0xfff)); [/CODE] Where addr is any user process memory address.. Note this method works...I just want to know if there is a better way | |
Ok so I make my masks [CODE] short m1, m2, m3, m4; m1 = 0xF000; m2 = 0x0F00; m2 = 0x00F0; m3 = 0x000F; [/CODE] and then I test my masks [CODE]printf("%hd %hd %hd %hd\n", m1, m2, m3, m4);[/CODE] when I test it the values come out as [CODE]-4096 240 … | |
Please, I need help in this little problem of printing all the prime numbers from to 100. Please, if you have more than one method to the question, I would really appreciate it. I also need it as soon as possible. Thanks. | |
hii i want c code for non preemptive scheduler where burst time and arrival time is given and u have to return waiting time from the function u will develop. please give code soon pleaseeeee.. | |
I am new to message queues and IPC in general. I am trying to have a process establish the queue and send a message. Then I fork and the child will read the message. The goal is to measure the execution time for different sized messages. The msgsnd is returning … | |
Hi there guys, So I have two arrays, and each arrays got 5 elements (integers). My goal is to to arrange the elements of each of those arrays in a descending order and save them in a new array. I started off with bubble sorting each of those arrays and … | |
Hey, How do you read from the command line in C? I need to read 10 arguments from the command line. Can I use char* argv[] as a parameter in the main function to do so? Thanks. | |
I made a program that inputs the radius of a circle, and then should output a circle of asterisks. however, I am just getting the fourth-quadrant part of the circle, and I need the whole circle to be printout. what do I need in my code? this is my code: … | |
Hi, I'm new here and I just need a little help with pointers and 2D arrays. I'm kind of new to programming so this might be redundant. I'm trying to make a 2D array of pointers (already have done) that points to another 2D array of double values... I have … | |
please provide the free pdf link of k & R c prog lang. i spent lot of time in googling but couldnot get it. thanks in adv. | |
So, I have a server process that forks for every client that connects. I keep a list of connected clients that I want each fork process to have. Of course, when the process forks the child only has what it had when the fork occurred. For the solution to this, … | |
sir, we want complete c programme for huffman encoding & decoding.im doing my b.tech project .please send me the code | |
[CODE] #include<stdio.h> #include<conio.h> #include<string.h> int n; char (*p)[40],*temp; void Input(); void ABCsorting(); void Input() { printf("How many persons u want to input: "); scanf("%d",&n); p=(char*)malloc(n*40*sizeof(char)); temp=(char*)malloc(n*sizeof(char)); int i; for(i=0; i<n ; i++) { printf("String %d: ",i+1); fflush(stdin); gets(p[i]); } printf("All strings before sorting: \n"); /*for(i=0; i<n ; i++) { printf(" … | |
Hi! I have had to change from Python to C because of university instructions. My problem is that, when I want to make a menu for my program or whatever, I always want to define classes:P My question is simple --> are structures the best way to "replace" classes? TY | |
I'm not sure about the difference between *p[5] and (*p)[5]? Please help me clarify them? Thanks a lot! | |
Hi there, I was trying to code a simple program that bubble sorts an array into a list of numbers arranged in a descending order: Here is the code I used: [CODE=c] #define size1 5 #define size2 5 #include <stdio.h> int main() { int a[size1]={8,4,5,2,3};//array 1 int i=0; int n=0; … | |
Dont know these types of questions are asked here or not but if any one has idea please help me. i just started started learning system programming and want to pursue a career in the sys prog area. below is the program that use a fork() call. i read in … | |
Hey guys, I've got an issue with the bowling program I've created. It's outputting the wrong scores, but I believe it's because of wrong bowling code. Is there anything wrong that you can see? One of the issues I'm having is frame 2, where the scores were 9 and 1, … | |
How do I generate random numbers in C? The user doesn't enter anything, I'm just looking for a way to generate random numbers every time I run the program. Thanks guys! | |
1. Write a C program to convert a given infix expression to postfix form using stacks 2. Write a C program to evaluate the postfix expression using stacks | |
I need a function that returns the name of a key directly from the keyboard, eg, the input of '32' would return 'Space'. I know there is a function that does this, but I can't figure out which one. | |
Hi to all, Could someone show me by giving a code about how to create dynamic an Array in C, (nxm) from strings and read values in this array ? Thanks in advance... | |
The following problem has to do with Arrays. I would appreciate if someone could give an explanation in this assumption below: If we assume that SIZE is a catholic constant with value 100 and A is Array of size SIZE with n stored elements from left to right. If it … | |
Hey everyone, For my project, I need to write an assembly/C code to detect multiprocessors. I really have no idea how as I have barely done assembly coding and I have no good reference or even idea how to start. Again, what I am going to do is, I'm trying … | |
Hello friends, I am having a problem writing a function to search for a string in an input file. I have successfully output the file with line numbers, which was the first step in the program, but now I am stuck on searching for a given string. After searching for … | |
I want to solution for following question b'case i am begineer 1 Following is the menu to be displayed to the user. On selecting a choice display appropriate result. Number should be accepted from the user. Menu 1. Prime Factors 2. Leap Year 3. Sum of all digits 4. Number … | |
The programming assignment is to read a text file, extract the words from it, and save them in a 2D array that contains the word and the number of occurrences of that word. For example, if a text file contains the words "first" "second" "third" "second", the array should contain … |
The End.