15,552 Topics
| |
Hey guys, I'm building a program in C that can get powers of 2. The user inputs the value of n, and the program calculates 2^n. Here's the code #include <stdio.h> double power(int n) { int q; double c=2; for (q=n; q>1; q--) {c=2*c;} return c; } int main() { … | |
hetThe code is the executing fine,but i need to keep a pointer variable to return the last index of the array //for eg if i enter n as 20,my lastindex is 19,the pointer will return the lastindex... void sort(int a[],int *,int); void swap(int a[],int *,int,int); int main(void) { int i,n,a[100],b[100]; … | |
## im begginer of c language n working on turbo now days,please tell me how can i repeat a program after run one time. i use while but on press any key this program run every time no exit.please correct it ## main() { char again='y'; while(again=='y'||again=='Y') { int a,b; … | |
Hey everyone, I never programmed before in no languages, but I would like to learn C, and I'm undecided on what book to read to learn from. I have no possible experience at all. May someone tell me as a beginner should I read either C Primer Plus by Prata? … | |
I was looking at some sample code [here](http://www.kernel.org/doc/man-pages/online/pages/man2/mmap.2.html) and it had this for error handling: #define handle_error(msg) \ do { perror(msg); exit(EXIT_FAILURE); } while (0) If I remember correctly do {} while (0) would execute only once, so what is the point of this? | |
I need to write equivalent 'c' code for vb code......... ImageScreen.Graphics.Pixel(i,j) = cmy(0,0,0) how to write a function for cmy in c language | |
Hellou. Can anyone tell me how can i save a string to a file? I have this function: void PrintGameBoard(jogo_4line*jg) { int i,n; system("clear"); printf("===============Jogo do 4 em linha===============\n\n\n"); printf(" +--+--+--+--+--+--+--+\n"); for(i=1; i<=6; i++) { printf("%d |%c |%c |%c |%c |%c |%c |%c |\n",7-i,jg->T[i][1],jg->T[i][2],jg->T[i][3],jg->T[i][4],jg->T[i][5],jg->T[i][6],jg->T[i][7]); if (i!=0) printf(" +--+--+--+--+--+--+--+\n"); } printf(" … | |
Hi, I'm working on some questions for homework and I have a small idea what the answers may be. Can anyone look my answers over and help me out maybe explaining why they may be wrong or right? Question 1: answer "b" Here is a diagram of memory: Which declaration … | |
What are the advantages of Macros over External(Global) variables? | |
I am still new with c programming, I need to create queue with first in first out but it is going last in first out. Can someone give me advice in how to make it work. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LENGTH 30 #define NUMOFEMPLOYEE 15 typedef struct … | |
Hi, I looked all over and since I'm probably not using the right termonlogy I couldn't find anything in Google. Here's what I'm trying to do (in ANSI C). I have a text that represents a series of bytes that looks like this: "08 FF AB 0B 12 76 CD" … | |
I need to create a sorting program with C from a txt file. I need to use bubble sorting and insertion sorting. All I have right now is what the professor gave us to start. I don't know where to go from here! Please help! Program so far: #include <stdio.h> … | |
void main() { unsigned int x=500; int y=-5; if(x>y) printf("hello"); else printf("hi"); getch(); } | |
Hi everyone, i got a question about the fscanf. I input a file and scan the data in the file. It works good that if there are integers in line1,2,3,4 in the file. However, it does not work good with empty file or the file only has dat in line … | |
please suggest me turbo c version for windows 7,32 bit which supports full screen mode and also supports graphics functionality....as soon as possible.... | |
Hi, I am trying to solve a maze using queues(no recursion) What I've done so far is that I can figure out whether or not the maze can be solved. What my next step should be is to list out STEP BY STEP how the maze will be solved. For … | |
suppose i have defined constant using #define MAX 5 and i am using it in function called find() as shown below: find() { if (MAX==5) { //do this; } else { //do this; } } ** If i am calling this function 100 of times** then which way is better … | |
Hi Everyone, I was wondering how I can implement a hashmap function in C. I have to define a struct: struct hashmap; typedef struct hashmap hashmap; This has to be a multimap so that a key can point to different values. If also need to initialise this hashmap like so: … | |
Hello i found that only register storage class is allowed in function.But it gives error when i mae it extern auto,extern static... Hello i found that only register storage class is allowed in function.But it gives error when i mae it extern auto,extern static... #include<stdio.h> int sum( int ,int,int ); … | |
http://www.codechef.com/COOK27/problems/TOURNAM Thanks in advance ! | |
Can you please give me hints or can you teach me how can i convert my simple client server program(in which only client can send any number of messages it want to server) to chat server client program ? I am doing this by trivial way, but still only server … | |
**i'm trying to sort the number in the ascending order,i have a problem in doing that....im quite new to c ** *my input is a={40,50,20,30};,b={20,30,40,50};my output will be a=20 30 40 50 ,b=40 50 20 30 * sorting all the columns of a data by one of its column int … | |
Write a program that reads a file, breaks each line into words, strips whitespace and punctuation from the words, and converts them to lowercase please help me out . thanks in advance | |
Alright i'm trying to write a program that checks a list of names entered by the user to see if the new name entered is part of the list. If it's not part of the list it should return -1 to the main, and print no names found, if it … | |
I don't know jack about Visual Studio, and I'd like to keep it that way because I like doing stuff on the command line, I have my preferences. But my teacher uses it to compile and I'm curious what I did wrong because gcc didn't throw anything. So, code (Without … | |
Could you please help me how to create a four in a row game in C? Thanks! | |
So I'm new to C and I'm having a problem with arrays. In my program, I let the user enter up to 5000 numerical values. I have the program set up in a menu system, so each time, the user can chose to enter a new number, or view what … | |
:#include<stdio.h> #include<conio.h> void main() { int i; float x[10],value,total; clrscr(); printf("enter ten real numbers"); for(i=0;i<10;i++) { scanf("%f",value); x[i]=value; } total=0.0; for(i=0;i<10;i++) total=total+x[i]*x[i];//eliminate total from here printf("/n") for(i=0;i<10;i++) printf("[%2d]=%5.2f/n",i+1,x[i]; printf("total=%2f/n",total); } if i write total=x[i]*x[i] =102 an another answer why?? nd if wrie=total=total+x[i]*x[i] =446.86 10 real number 1.1, 2.2 ,3.3 ,4.4 … | |
I want the program can do that for me. When I enter the name of file in the same folder of .exe, the program will scan the file data and print it out the data in order. However, i do not know how to scan the data in the file … |
The End.