- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 15
- Posts with Upvotes
- 13
- Upvoting Members
- 8
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
- PC Specs
- Linux , Windows
Re: post your code here. We'll help you to solve your problem. | |
Re: well.. i don't think there is anything left to comment but there is so many things to learn (specially for me) from the above post.. :) | |
Re: Try this code.. [CODE] # include <stdio.h> # define MAX 100 int main(void) { int oddcount, evencount; int array[MAX],i,n; printf("\n Enter Array Size (Between 1 to %d ): ",MAX); scanf("%d", &n); // User enters Array Size for(i = 0; i < n; i++) { printf("\n Enter %d value: ",i+1); scanf("%d", … | |
Re: Well as Narue suggested.. scanf function leaves '\n' into buffer, so when it reaches [CODE] while((character=getchar())!= '\n')[/CODE] reads '\n' from buffer and loop terminates. after this you are using [CODE]puts(sentence);[/CODE] it will print some garbage value on screen bcoz your string is not terminated by a '\0' char. to overcome … | |
Re: Before For loop initialize all elements of array hist_grade[6] to 0. line 22: why are you destroying all values of grade[i] to 0.. can't get the need of this line.. switch statement should me inside for loop.. line 24: [CODE]switch(grade[32])[/CODE] should'nt it be [CODE]switch(grade[i])[/CODE] line 28: how can you use … | |
Re: [CODE] char* my_strrev(char *p){ int i,l,temp; for(l=0;*(p+l+1);l++); for(i=0;i<l;i++,l--){ temp=p[i]; p[i]=p[l]; p[l]=temp; } return p; } [/CODE] This Function will work like strrev() Function... | |
Re: well.. i could not understand the need of copystring function in your program. you are using two pointer to char type of variables. when we deal with pointers then this could be done by = operator.. try this one. [CODE] #include <stdio.h> int main(){ char* string1="Hello World!!"; char* string2; printf("string1: … | |
Re: make your function as @Ancient Dragon says. and no need to print str1 using for loop in main function. just use [CODE] printf("%s",str1);[/CODE] | |
Re: well... you just passing a 2D array as a 1D array. then just use this code [CODE] int findMin(int* array, int num_rows, int num_cols){ int min = *array; // or can use array[0] int i; for( i = 1; i < num_rows * num_cols; i++){ if(min > *(array + i)) … | |
Re: its wrong.. [CODE] struct LinkedList { int num; struct LinkedList *next; }; typedef struct LinkedList; NODE *node,*start,*temp; [/CODE] you are using [code] typedef struct LinkedList; [/code] change this line with [CODE]typedef struct LinkedList NODE;[/CODE] | |
Re: Post your code here showing your effort towards solving this program. | |
Re: " i just create 1 exe file so that when i double click it. it automatically runs & produces the required output.although the s/w itself produces the exe file. but it opens along with all the supported/assosciated files with it. i just require only 1 exe file. " i think … | |
Re: @ phobos666 you have just declared a char array [CODE] char airfoil[6]; [/CODE] that means it'll store 6 single char including '\0' char. you want to store 6 string having 3 char that means you need to declare a string array or can say 2 dimension char array. your program … | |
Re: @hsetaknev line 4: [CODE] void main() [/CODE] main always returns a int value so it must be [CODE] int main() [/CODE] line 5: when you are asking to the user for the value of n then no need to initialize n=9. line 13: could'nt unserstand the need of /0 here … | |
Re: you can use [CODE] while ( scanf( "%d", &ch) == 1 ) { .... .... } [/CODE] The vast majority of functions will give you some indication of success or failure. Especially with input it's best to make sure that the call succeeded before proceeding as if it did. In … | |
| |
Re: @ gaurav I am also using CODEBLOCKS and i compiled your program and its working fine. its showing sorted output after inputting desired values.. | |
Re: Why do'nt you use Array instead of using five variables. like int num[5]; Declare.. int max, min Use a loop and scan all values initialise max and min variable to num[0] now run a loop and compare all values of array num[5] with both variables.. | |
I am using CODEBLOCKS and I am creating a program that performs basic operations like add, delete and insert on Doubly LinkList , My Program is working fine on older Turboc compilers. But when i run it on codeblock its causing problem when i try to delete a node. [CODE] … | |
Re: Post your code that you have tried and not working.. and please start new thread for new problem.. after your problem get solved mark your thread as solved.. | |
Re: Embed your program code between code tags.. and use int main(void) instead of void main(void) Remove getch() from the end main always return a integer value so use return 0; | |
The Program is Addition of Large Integers.. Although This program is working But I want to know where i went wrong or what should i need to do to make it better.. [CODE] # include <stdio.h> # include <stdlib.h> # include <ctype.h> # include <string.h> typedef struct poly { int … | |
Re: Have'nt you done anything on your own..?? Post your Code here... | |
Re: If you want to create this function then try this one.. [CODE] void make_date(int *d,int *m,int *y,int days) { int flag=0,temp=0; // variable days must have positive integer value while(flag <days) { (*d) ++; if( (*m) == 4 || (*m) == 6 || (*m) == 9 || (*m) == 11) … | |
Let P1 and P2 are two polynominals.. where p1 = 1 + 4X^2 + x^4 and p2 = 2x^2 + x^4 program is to multiply p1 with p2 p3 = p1 * p2 Like line 1: ( 1 + 4x^2 + x^4) (2x^2 + x^4) line 2: 1*(2x^2 + x^4) … | |
Re: For that you need a good knowledge of programming, like you need to know worst case complexity, best case complexity and Average time complexity. [URL="http://en.wikipedia.org/wiki/Computational_complexity_theory"] Read This[/URL] | |
Re: Its wrong way of passing a variable address to a Pointer [CODE] *nextRow = &row; // sets up an arbitrary "first guess" *nextColumn = &column; // with row, column both = 0 [/CODE] It should be [code] nextRow = &row; nextColumn = &column; [/code] | |
Re: if you are not new to C language then you can use malloc or calloc function to create your Arrays.. |