Posts
 
Reputation
Joined
Last Seen
Ranked #4K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
100% Quality Score
Upvotes Received
2
Posts with Upvotes
1
Upvoting Members
2
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
1 Commented Post
0 Endorsements
~2K People Reached
Favorite Forums
Favorite Tags

11 Posted Topics

Member Avatar for Adnan S.

[code=c] #include <stdio.h> int main() { int n = 12345; int sum = 0; while (n != 0) { int c = n%10; sum += c; n /= 10; } printf("The sum is %d\n", sum); return 0; } [/code] this should work just fine

Member Avatar for sneekula
0
979
Member Avatar for doublex

hi there, i try to map a file in memory, in linux, using mmap, so that what i write in memory will be written in the file as well. the piece of code looks like this [code=c] fd = open(argv[1], O_RDWR); if (fd == -1) { error_message(__FILE__, __LINE__, "'open' failed …

Member Avatar for doublex
0
132
Member Avatar for sathishkumar.e

[QUOTE=Duoas;479041] [code=C] strcpy( s1, argv[ 1 ] ); strcpy( s2, argv[ 2 ] ); [/code] [/QUOTE] Please don't do that again!

Member Avatar for Duoas
0
142
Member Avatar for boyz

really? can you? hmm... never thought about that... but from what i know, when the if clause is true the esle clause doesn't get to be tested, so it won't execute and when if cluase is false, then it will be executed the else clause. can an expression be true …

Member Avatar for WaltP
0
125
Member Avatar for asilter

[code=c] int status; int options; ... switch (pid = fork()) { case -1: /* fork failed */ printf("forked failed\n"); exit(-1); case 0: /* child starts executing here */ execl(...); default: /* parent starts executing here */ waitpid(pid, &status, options); ... } [/code] You can then examine status, ans see how …

Member Avatar for Duoas
0
123
Member Avatar for mank

i think you can use a backtracking algorithm. i don't have time to write some code, but you get the idea. you will need a linked list instead of arrays, for better memory usage. every element in the list will be another list containing a sequence like those in the …

Member Avatar for Narue
0
113
Member Avatar for boyz

if you have a[10] a refers to the address of the first element of the array so you will have 10 * sizeof(int) bytes occupied by the array.

Member Avatar for Ancient Dragon
0
285
Member Avatar for boyz

[QUOTE=boyz;475923]1.main() 2.{ 3. int a=0; 4. while(...) 5. { 6. int a=9; 7. } 8.} now friendz question is question is what make a of 3 global and a of line 6 local what is happend at the time of local decla.. and at the time of global decl... would …

Member Avatar for Salem
0
102
Member Avatar for boyz

[code=c] #include <stdio.h> int main() { int a=2, b=3, temp; printf("a: %d, b: %d\n", a, b); (temp = a) && (a = b) && (b = temp); printf("a: %d, b: %d\n", a, b); return 0; } [/code] is this what you are looking for?

Member Avatar for Duoas
-1
132
Member Avatar for boyz

maybe the man really needs to know this stuff.. [url]http://livefusion.wordpress.com/2006/08/24/c-program-without-main/[/url] i like the one with the #define, really nice :D

Member Avatar for doublex
0
97
Member Avatar for boyz

actualy, if the subscript is greater than the size of the array 2 things can happen: 1. the value will be storred in the next memory location, calculated by the index, so if v[10] is a vector, than v is the address of its first element, and v[i] is *(v+i) …

Member Avatar for biswajit.bhuyan
0
71

The End.