15,552 Topics

Member Avatar for
Member Avatar for Icekilla

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() { …

Member Avatar for Adak
0
172
Member Avatar for prathiyus

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]; …

Member Avatar for prathiyus
0
133
Member Avatar for kidpro

## 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; …

Member Avatar for Adak
0
129
Member Avatar for php111

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? …

Member Avatar for php111
0
749
Member Avatar for IAMADOG

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?

Member Avatar for deceptikon
0
125
Member Avatar for prathiyus

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

Member Avatar for Adak
0
77
Member Avatar for joao.jose.520

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(" …

Member Avatar for Adak
0
230
Member Avatar for code_r

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 …

Member Avatar for Gonbe
0
168
Member Avatar for amrita111
Member Avatar for amrita111
0
153
Member Avatar for tahity1

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 …

Member Avatar for VernonDozier
0
123
Member Avatar for amishosh

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" …

Member Avatar for deceptikon
0
193
Member Avatar for sunygirl92

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> …

Member Avatar for Adak
0
153
Member Avatar for bikash barad

void main() { unsigned int x=500; int y=-5; if(x>y) printf("hello"); else printf("hi"); getch(); }

Member Avatar for amrita111
0
95
Member Avatar for leesin

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 …

Member Avatar for leesin
0
95
Member Avatar for chandnigandhi

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....

Member Avatar for Ancient Dragon
0
97
Member Avatar for ja3n

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 …

Member Avatar for ja3n
0
3K
Member Avatar for katsmiley

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 …

Member Avatar for deceptikon
0
162
Member Avatar for gwolf1

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: …

Member Avatar for deceptikon
0
569
Member Avatar for sachi059

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 ); …

Member Avatar for deceptikon
0
872
Member Avatar for prakhs
Member Avatar for nitin1

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 …

Member Avatar for nitin1
0
2K
Member Avatar for prathiyus

**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 …

Member Avatar for prathiyus
0
334
Member Avatar for vipulasri.2007

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

Member Avatar for vipulasri.2007
0
676
Member Avatar for jcmoney1010

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 …

Member Avatar for dmanw100
0
112
Member Avatar for dancks

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 …

Member Avatar for dancks
0
198
Member Avatar for RadhikaR
Member Avatar for Ancient Dragon
0
43
Member Avatar for AnnA.B

Could you please help me how to create a four in a row game in C? Thanks!

Member Avatar for joao.jose.520
1
1K
Member Avatar for samii1017

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 …

Member Avatar for Ancient Dragon
0
223
Member Avatar for aman55

:#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 …

Member Avatar for alaa sam
0
173
Member Avatar for leesin

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 …

Member Avatar for Ancient Dragon
0
150

The End.