406 Posted Topics

Member Avatar for abhi_marichi

[QUOTE=abhi_marichi;812472]I need to execute some dos commands like executables(.exe) PLEASE HELP ME OUT OF THIS[/QUOTE] Read more about the "system" command in C language.Your every requisite would get fulfilled. Through system command you can call all commands you can call in a command prompt mode and also execute certain kinds …

Member Avatar for Narue
0
139
Member Avatar for slimjimmer

[QUOTE=slimjimmer;814882]Thanks for you help. I have figured out what I am doing wrong. For future reference though, is it possible to declare an array of strings? Isn't that effectively an array of character arrays?[/QUOTE] You are exactly right . Array of strings is effectively an array of character arrays. As …

Member Avatar for csurfer
0
158
Member Avatar for hellIon

>Naure How about using this assuming the numbers passed as strings are within the integer range... [code=c] if ( argc >= 3 ) { num1=atoi(argv[1]); num2=atoi(argv[2]); printf ( "%d\n%d\n", num1, num2 ); } [/code] Or if the coder is sure to get only singe digit numbers he/she can just use …

Member Avatar for Narue
0
156
Member Avatar for gayatridas

[QUOTE=gayatridas;815257]I have a sequence of 5 numbers. I want to write it in reverse order. Could you please help me that what will be the algorithm?[/QUOTE] This is different from the question dealt in this thread so start a new one...

Member Avatar for moonw3ll
0
139
Member Avatar for rambo123

For pointer concept you look at the post by Naure I am just throwing some light on similarities between variable increment and pointer increment. (Thought that would help you link these two things and understand better.) 1) variable + 1 = value of variable + 1 pointer + 1 = …

Member Avatar for csurfer
0
112
Member Avatar for stepipai

Hey its simple you just need to do the same working as you would do on a paper. Take the fraction as a string and break it into tokens with delimiter as "/" . Now you get the numbers as characters. Just convert them into integers and use them in …

Member Avatar for csurfer
0
95
Member Avatar for britto

(Someone's really joking with you when he/she said you to write a compiler in 2 months.In this time you cant even study the basics properly.And moreover you don't know whats LEX and YACC is which can be treated as foundation stones to compiler building.So please stay away from words like …

Member Avatar for MosaicFuneral
0
431
Member Avatar for shaieen

[QUOTE=shaieen;811195][B]i research a code, and it goes like this:[/B] [code=c] #include<stdio.h> #include<conio.h> void main() { int a[12],b[12],c[12],i,j=0,k=0; clrscr(); printf("Enter 12 numbers\n"); for(i=0;i<12;i++) { scanf("%d",&a[i]); } for(i=0;i<12;i++) { if((a[i]%2)==0) { b[j]=a[i]; j++; } else { c[k]=a[i]; k++; } } printf("The even numbers are\n"); for(i=0;i<j;i++) { printf("%d\n",b[i]); } printf("The odd numbers are\n"); …

Member Avatar for shaieen
0
150
Member Avatar for Dewey1040

Well thats a pretty nice approach. Mainly you need to know one thing.Its up to the coder to use his code in the fashion he likes.If you are using these functions only in this program then let it be in main.c itself. If you think you can use these programs …

Member Avatar for Dewey1040
0
99
Member Avatar for SADIYA4

The above stated answers by luckychap and salem is what you need to do to make your swing move ie clear and redraw. But instead of clearing the entire screen its better to clear only a part of the screen.You can just go through the concept of VIEWPORT and move …

Member Avatar for csurfer
0
56
Member Avatar for daniellamae

Yes you have really messed up the code at some places :) Well I wont give you the codes but will help you out in pointing your errors and what you need to add to your codes.Here it goes: [code] void readA(int A[]){ int A[inte]; printf("\nenter an integer : "); …

Member Avatar for csurfer
0
127
Member Avatar for ronizam

[QUOTE=ronizam;807812]print the decimal, octal and hexadecimal values of all character between the start and stop character entered by user, For example, if the user enters and 'a' and 'z', the program should print all the character between 'a' and 'z' and their respective numerical values. make sure that the second …

Member Avatar for Dewey1040
0
118
Member Avatar for ronizam

[QUOTE=ronizam;807791]i already start with simple program,look like it easy, but when come to more complicated program, dont know what to do, maybe its a late start for me to do programming, i am 33years old, taking online learning, with work and family...[/QUOTE] Salem's guidance is really splendid. You need to …

Member Avatar for csurfer
0
103
Member Avatar for bossie09

Well when all the functions have been already given in math.h why do you want to re-write them ? You can just take the input in degrees from the user and convert it into radians and feed into functions. Well if you want to know the basics more and write …

Member Avatar for csurfer
0
171
Member Avatar for odzky

[QUOTE=odzky;809747]Create a function w/c accepts as input the double numbers x1,x2,x3 and returns to the program the value of the average (x1+x2+x3)/3 as a variable parameter. #include<stdio.h> #include<conio.h> main() { i really dont know what next...........[/QUOTE] Look programming is like a game.It has its own set of rules. On coding …

Member Avatar for Ancient Dragon
0
278
Member Avatar for bhavya_talluri

[QUOTE=bhavya_talluri;801595]hi i just want to know how to write a c program for heap sort. please help me[/QUOTE] Do you know how to sort numbers according to Heap Sort manually on paper ? I hope your answer is yes,if not learn that first without it you cant understand how to …

Member Avatar for abhishaki
0
115
Member Avatar for JONZ

@JONZ Your question doesn't specify your need correctly.Well I could frame two questions out of it. So answering them. 1)How to create stacks and trees? Stacks can be created using many methods. By Arrays, using a variable to act as top indicator. By Linked List, using a node pointer to …

Member Avatar for death_oclock
0
317
Member Avatar for Skorpion

All the above listed algorithms are the bests you can find to sort an array of numbers but I would prefer this order for you to start with as you are a starter. 1>Selection sort 2>Bubble sort 3>Quick sort 4>Merge sort 1 Tells you how to start sorting with help …

Member Avatar for TheBeast32
0
152
Member Avatar for RexxX

Well in my view allocating array[15][100] would be faulty as that may lead to array overflow and illegal memory access in some cases(Because here you are handling files). And not all files are longer there may be small files which may not use most of the allocated memory or some …

Member Avatar for Ancient Dragon
0
110
Member Avatar for omdnaik

Not only a structure...You cannot define anything dynamically. You can just set values to already allocated or defined variables.Even in functions like malloc where you allocate memory dynamically during run time you only allocate memory to predefined or declared variables. Creating a completely new entity is not at all possible.

Member Avatar for ArkM
0
119
Member Avatar for ithelp

[QUOTE=ithelp;801893]Hi C experts, In my code I have got #pragma extern_prefix (push, ""); Some extern function declarations #pragma extern_prefix (pop, ""); So that compiler does not prepend anything to those extern functions , I get an error error #14: extra text after expected end of preprocessing directive Does anyone know …

Member Avatar for death_oclock
0
5K
Member Avatar for DLightman

[QUOTE=DLightman;802374]I like the function better. I'm having a bit of a mind block about though. I know I have to iterate through arr[17]. But how do I stop at the 4th element, switch to a new array and read the next 4 chars?[/QUOTE] Well I respect your zeal to write …

Member Avatar for DLightman
0
64
Member Avatar for slimjimmer

malloc not freed and Array overflow errors as indicated by Aia should be checked and the error over flow in line no 64 causes error in every compilation and hence comes in notice. But the same Array overflow error in Line 135 comes over only in certain cases and hence …

Member Avatar for slimjimmer
0
150
Member Avatar for Skorpion

Hey all the beautiful help given to you above should increase the interest in you to build the program.The help given above is splendid read it again. Well try this: 012345678 0123*5678 012***678 01*****78 0*******8 ********* 0*******8 01*****78 012***678 0123*5678 012345678 If you assume the space to be a linear …

Member Avatar for Prabakar
0
131
Member Avatar for bemo55

[QUOTE=bemo55;801600]I just learned pointers in my computer science class and i am having a hard time understanding what they are used for. Are they absolutely necessary to use them when passing arrays from functions ect. or is it just a more efficient way of doing so?[/QUOTE] Don't look at the …

Member Avatar for ArkM
0
109
Member Avatar for premsharma

[QUOTE=premsharma;801764]hello nice help from this site, pls help me for program problem : C program to read a list of names ending on a '$'. Each name ends on '.' and contains maximum of 30 characters. our program must convert the format as indicated in the example below and print …

Member Avatar for csurfer
0
166
Member Avatar for monkey_king

[QUOTE=monkey_king;800004]Hey, does anyone know if it possible to have something like [CODE] #DEFINE NUM_DEC 4 printf("This is your value:%.NUM_DECf\n"); [/CODE] thanks in advance[/QUOTE] Its impossible because anything other than data type specifiers and escape characters within double quotes of printf function is treated as string or character constant and is …

Member Avatar for Prabakar
0
98
Member Avatar for claretm

[QUOTE=claretm;800118]Thanks for the reply. If this gives all the prime numbers less than 1000000,how can i modify this to get the largest difference between two consecutive prime numbers? [/QUOTE] Well you need to know one thing very clearly that your program is not generating prime numbers up to 1000000 as …

Member Avatar for claretm
0
3K
Member Avatar for ohnomis

[code=c] void displayUnion( iUnion ); union integer_union { char c; short s; int i; long l; }; typedef union integer_union iUnion; int main() { iUnion value; //code continues [/code] Hey in your program you are declaring a prototype of function display as shown below: [code=c] void displayUnion( iUnion ); [/code] …

Member Avatar for Aia
0
167
Member Avatar for priyankasaini

[QUOTE=priyankasaini;798907]please write a programme to sort array of integers using quick sort[/QUOTE] I hope you have read this community rules. Everyone here is capable of solving this thread but we are here only to help people who really are struggling to get knowledge and are working themselves.Even we are learning …

Member Avatar for Salem
0
81
Member Avatar for ajhais

[QUOTE=ajhais;798248]Given a n*n grid with free spaces and obstacles in the form an n*n integer matrix. We need to find shortest between any two given points (x1,y1) and (x2,y2) through the free spaces. We are not allowed to move in diagonal. Please help me figuring out an algorithm for doing …

Member Avatar for Prabakar
0
105
Member Avatar for abby2589

[QUOTE=abby2589;798564]can you give an example of sorting? in c..tnx![/QUOTE] There are many : Bubble Sort,Merge Sort,Quick Sort. And yes "can you give" is one of the phrases you should use in this community only after you yourself do some work on it.Hope you have done it.

Member Avatar for death_oclock
0
98
Member Avatar for Kraizy

The real problem here is recognition of a word. And as we all know word is a linguistic concept and we cannot be fool proof while programming for such concepts. The only way I see is to implement AGNI's method for the start and move assuming the sentence is a …

Member Avatar for axyelp
0
180
Member Avatar for kishore84

Apart from the heavy memory consumption problem stated by "death_o_clock" which need to be corrected,your program has other major errors. 1> picked[8] can carry flags only up to integer 7 and [code=c] for (i = 0; i < 9; i++) picked[i] = 0; [/code] will itself give error.Therefore picked[9] is …

Member Avatar for William Hemsworth
0
2K
Member Avatar for SagarVaze

Well I am not able to point out your mistakes exactly but this code does work: [code=c] #include<stdio.h> struct node{ int a; char b; }; typedef struct node * NODE; int main() { NODE n; int *in; char *ch; n=(NODE)malloc(sizeof(struct node*)); in=&(n->a); ch=&(n->b); *in=10; *ch='a'; printf("%d %c",*in,*ch); return 0; } …

Member Avatar for Aia
0
2K
Member Avatar for Skorpion

A small addition to both the codes mentioned above. The rule for being a Prime Number in maths states that a number is prime if it cannot be divided by any number (actually any prime number ) <= the square root of the number given. that is: [code=c] for( i=2 …

Member Avatar for Skorpion
0
80
Member Avatar for CPPRULZ

malloc(<size>) just allocates a memory space for the size specified and returns a void * pointer pointing to the starting of the allocated memory block. It returns a void * pointer (so that it can be type cast to any pointer type) and as you know void * pointer itself …

Member Avatar for Narue
0
381
Member Avatar for donjohnson24

I tried your original C file Racenite.c on Windows OS on TC compiler and it is running fine without errors. And no display problem too.

Member Avatar for donjohnson24
0
142
Member Avatar for rajenpandit

All header files are taken from the include directory. May be the compiler is not responding because your newly created header file may not be in its search path.

Member Avatar for Freaky_Chris
0
92
Member Avatar for moonw3ll

The real essence of C is in the discovery of C by yourself so try to discover more and read books like "ANSI C" by Kernighan and Ritchie. 1.Try to print the Pascal's Triangle (This requires only looping and a bit of array knowledge.) 2.You need to start imagining and …

Member Avatar for moonw3ll
0
259
Member Avatar for Rein Valdez

If you just want to extract the index (part after the decimal pointer) you can use this method also (in case your index part is in integer bounds) If you have scanned it as a floating point number: 1>Convert it into a STRING. 2>Then use standard function strtok() with the …

Member Avatar for Aia
0
162
Member Avatar for swetharvss

Well here is a code in which you can generate numbers from 1 to 1023 i.e all numbers that can be represented in 10 bits.This is just one of the implementation and there are several other simpler ones too...You wanted access for all the bits so this is one way.You …

Member Avatar for swetharvss
0
282
Member Avatar for Lolly2009

Hey I feel there are some errors in your posted code: [code=c] int main(int argc, char *argv[])/*command line input*/ { int len; char *t[10]; len=strlen(argv[argc-1]); temp[0]=argv[argc-1] if(strstr(t[0],"c"==NULL)/*to check for a c file input*/ printf("Not a c file"); else printf("C file"); } [/code] In line 6 and 7 it should be …

Member Avatar for ArkM
0
221
Member Avatar for Trendkiller

Include your codes within the code syntax.Its really hard to analyze it without it.Have a look at the code tags.

Member Avatar for csurfer
0
109
Member Avatar for marksmania

Only the IEEE notation of floating point is able enough to hold the planks constant. As it is a very small number and the first non zero number comes only after nearly 33 digits and so your number gets truncated to first 6 places only. Therefore 0.000000 and as soon …

Member Avatar for csurfer
0
98
Member Avatar for bundersi

This isn't so easy.Even long integer cannot hold the complete length of the input you are assuming so we need to split the number into digit basis and proceed. 1>Take three array's A , B and C of size 100 each and initialize all their values to 0. 2>Take the …

Member Avatar for Salem
0
157
Member Avatar for me_ansh

In my knowledge there is no such inbuilt way in C language to get the last modified time. The file doesn't hold such information even in Linux platforms.The file table has all such information but accessing it through just C language statements is doubtful. May be you can include a …

Member Avatar for Salem
0
158
Member Avatar for ahamed101

@ahamed101: In my knowledge your usage of void * pointers are wrong. The sole purpose of introduction of void * pointers in C is to include the concept of polymorphism and the basic limitation of void * pointers says that it cannot be dereferenced. that is: [code=syntax] int *p,x=10; void …

Member Avatar for ahamed101
0
110
Member Avatar for drjay1627

I may be wrong but what I feel is the pid_t data type within switch() is causing the error with -1. As negativity of the choice element is not correctly defined in some cases its better if you use an integer variable to hold the ForkPid value. as int pid; …

Member Avatar for drjay1627
0
143
Member Avatar for lonely_girl

Yes you need to remove the usage of "goto" statement.Below is one of the several ways how you can remove the goto. [code=syntax] repeat: printf("\nEnter current year:"); scanf("%d",&cy); printf("\nEnter current month:"); scanf("%d",&cm); printf("\nEnter current date:"); scanf("%d",&cd); printf("\nEnter birth year:"); scanf("%d",&by); printf("\nEnter birth month:"); scanf("%d",&bm); printf("\nEnter birth date:"); scanf("%d",&bd); if (cy<=0 …

Member Avatar for lonely_girl
0
136

The End.