519 Posted Topics
Re: Why dont you create a simple text file. Put what ever data you want to put in that file. After that you can use something like the chmod command | |
Re: [QUOTE=Whilliam;1120719] [code] void main() { trie t; int ctr; for(ctr = 0; ctr < max; ctr++) t.(*letter)[ctr] = NULL; } [/code] [/QUOTE] You have to write [code] for(ctr = 0; ctr < 10; ctr++) t.letter[ctr]=NULL; [/code] | |
Re: I would advise you to use structures instead of so many arrays. Swapping structures is as easy as a=b This will reduce the chances of error in your code | |
Re: Check out this link. I think this will be useful [url]http://www.linuxquestions.org/questions/programming-9/c-howto-read-binary-file-into-buffer-172985/[/url] | |
Re: [QUOTE=WaltP;1120555] Or, knowing the limitation of [iCODE]int[/iCODE] [/QUOTE] What is this limitation ? | |
Hello Everybody, I have just come across this particular piece of code in a C problem set [code= c] main() { int i=5,j=6,z; printf("%d",i+++j); } [/code] The answer for this question is 11 because C evaluates this as i++ +j. But why cant this be evaluated as i+ ++j. Is … | |
Re: [code=c] struct host_msgs_list *root, *temp, *temp1; root = NULL; temp=root; [/code] Are all these local variable or are these global variables ? | |
Re: In general you have do some thing of this sort [code=c] while(1) { //Accept a new command from the user // Fork a new process // The child process handles the new command, finishes it and returns the status to the parent } [/code] | |
Re: Are you allowed to use relational operators ? If yes you could do something of this sort [code=c] total_marks= 85 //For example if the total marks are 85 printGrades(total_marks); void printGrades(total_marks) { i=total_marks; for(;i>=90;) { printf("A\n"); exit(1); } for(;i>=80;) { printf("B\n"); exit(1); } } [/code] | |
Re: Quick question can you do something of this sort ? Will help you to simplify the code ? [code=c] void calc() { // Check which operation is to be done // Then call the appropriate function } [/code] Check this link for more information on function pointers [url]http://www.cprogramming.com/tutorial/function-pointers.html[/url] | |
Is there any standard rules when we write the main function. I always thought the main function should always be written as [code=c] int main(int argc, char* argv) { ..... return 1; } [/code] But to my surprise, all these definitions are also correct . I got a compile time … | |
Re: Or you can use pointers. Some thing of this sort [code=c] int main(int argc, char* argv[]) { char *p; p="hellow World"; printf("%s\n",p); return 1; } [/code] | |
Re: [QUOTE=Gaiety;1115279]Yet Another Version of Findind a Prime number: [CODE] #define CHK_NUM_IS_2_3_5( n ) ( n == 2 || n == 3 || n == 5 ) #define REM_2( n ) ( n % 2 != 0 ) #define REM_3( n ) ( n % 3 != 0 ) #define REM_5( … | |
Hello All, I am unable to understand this piece of code [code= c] main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } [/code] I got this question from a C problem set. I run this code and I have to give the i/p 3 … | |
Hello, I have a conceptual code related to the C memory allocation model if I have some code of this form, I will get a seg fault [code=c] int main() { char* p; *(p+5)='A'; printf("%c\n",*(p+5)); } [/code] But when I have some code of this form I do not get … | |
Re: You can check out this link. I think this contains sufficient information to get you started at least [url]http://en.wikipedia.org/wiki/Multiplexer[/url] | |
Hello, [code= c] main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); } [/code] The answer to this question is 4 1 and the reasoning is that the compiler finds j to be true and hence does not need to check the remaining … | |
[code=c] union u { union u { int i; int j; }a[10]; int b[10]; }u; main() { printf("n%d", sizeof(u)); printf(" %d", sizeof(u.a)); printf("%d", sizeof(u.a[4].i)); } [/code] Hello People. I just came across this piece of C code. I have a couple of question The third printf statement gives me the … |
The End.