Forum: C Jan 30th, 2009 |
| Replies: 2 Views: 211 1. Construct two matrices.
2. Declare two 1-D arrays called rowAdd and colAdd to hold the values you obtain when you add the row and column elements respectively.
3. Once you find the sum of all... |
Forum: C Jan 28th, 2009 |
| Replies: 5 Views: 419 That doesn't make much sense. What you said(IF you said what I think you said) can be achieved more conveniently using a loop. |
Forum: C Jan 28th, 2009 |
| Replies: 6 Views: 219 Hooray for the internet (http://letmegooglethatforyou.com/?q=merge+sort+in+c) |
Forum: C Jan 28th, 2009 |
| Replies: 5 Views: 419 Use int main(), indent your code, use switch cases and a while loop instead of goto and if cases. |
Forum: C Jan 28th, 2009 |
| Replies: 6 Views: 219 Your post gave me an adrenaline rush. Honestly!:icon_eek: |
Forum: C Jan 28th, 2009 |
| Replies: 11 Views: 546 There are quite a lot of mistakes in your program (still!). So instead of pointing out each and every of them, I just whipped up my own code and have offered explanations through comments.
... |
Forum: C Jan 28th, 2009 |
| Replies: 13 Views: 728 >>Take a C course in some center in your city. WILL help you out...
I think a C course is a waste of time(even when you've got some to spare). I've learned more from the Internet and Daniweb than I... |
Forum: C Jan 27th, 2009 |
| Replies: 13 Views: 728 I gave you 3 points on which to work on. You didn't bother to make any corrections in your next post or even ask questions about what I had suggested. There are a lot of other fundamental syntax... |
Forum: C Jan 27th, 2009 |
| Replies: 13 Views: 728 You gotta use code tags for people to consider answering to your post.
Here's the syntax:
.
.
your code here
.
. |
Forum: C Jan 26th, 2009 |
| Replies: 8 Views: 876 You can also look up RSA (http://en.wikipedia.org/wiki/RSA) or DES (http://en.wikipedia.org/wiki/Data_Encryption_Standard) if you are dealing with delicate data. But they are both quite complicated... |
Forum: C Jan 17th, 2009 |
| Replies: 3 Views: 1,245 As mentioned before, it makes more sense to make sure that the list is in order while inserting than to apply a sorting algorithm later.
You can try this:
liste_t* Insert (liste_t *listptr, int... |
Forum: C Dec 28th, 2008 |
| Replies: 14 Views: 2,522 That's wrong. You're allocating memory for only one character. Should be dd[2].
This statement adds the ASCII values of '2' and '3'. So your result will be 50(ASCII value of 2) + 51(ASCII value... |
Forum: C Dec 26th, 2008 |
| Replies: 5 Views: 705 Use of goto is frowned upon. The only place where it's usage is justified is when you're in a nest of loops and wanna come out of it with the least amount of hassle. As Salem has already suggested,... |
Forum: C Dec 24th, 2008 |
| Replies: 11 Views: 916 I guess that was a li'l too much information, but he wasn't just asking about the labeling(I thought it would be too obvious a thing to ask). I assumed he was talking about array subscripts. Oh... |
Forum: C Dec 24th, 2008 |
| Replies: 18 Views: 1,255 Does that ever actually happen? I thought arrays are always assigned contiguous blocks of memory. |
Forum: C Dec 21st, 2008 |
| Replies: 7 Views: 903 You can use the reference (http://www.cplusplus.com/reference/clibrary/cassert/assert.html) if you aren't sure of how the assert function works. I think in your program, you've to "assert" that the... |
Forum: C Dec 21st, 2008 |
| Replies: 18 Views: 1,255 What's glblclrtab pointing to? It'll have a NULL value or a garbage value which is causing segmentation fault. After you make it point to a character array, you can use *(glblclrtab+i)= (char) i1; or... |
Forum: C Dec 20th, 2008 |
| Replies: 11 Views: 916 You could actually do it by declaring one extra row and column for each matrix that you declare. Then you can make the first row and the first column redundant, then do all the operations on the rest... |
Forum: C Dec 20th, 2008 |
| Replies: 11 Views: 916 What way did I suggest? If you're talking about starting from row 1 by using the for loop I've "suggested", then you're obviously gonna land in trouble since you're skipping the data in row 0(which... |
Forum: C Dec 20th, 2008 |
| Replies: 11 Views: 916 And you can start a row from 1 just by replacing for (r = 0; r < rows; r++) with for (r = 1; r < rows; r++), but you shouldn't do it(
unless you really know what y-ou're doing) since arrays'... |
Forum: C Dec 20th, 2008 |
| Replies: 3 Views: 571 It was already explained to you by Ancient Dragon in your previous thread. (http://www.daniweb.com/forums/post759666-2.html) |
Forum: C Dec 20th, 2008 |
| Replies: 11 Views: 916 The same program works fine in my compiler (code::blocks using GCC). It prints the line "Sum of all elements = %d" too. |
Forum: C Dec 19th, 2008 |
| Replies: 5 Views: 693 struct sale Weekly_Sale[13];
What you're doing here is creating a user-defined variable called Weekly_Sale of type 'struct sale'. It's logically similar to creating arrays of defined types and you... |
Forum: C Dec 16th, 2008 |
| Replies: 5 Views: 1,418 You're missing a semi-colon after defining the struct.
Should be:
struct names{ // definitions
-----
----
----
}; |
Forum: C Dec 16th, 2008 |
| Replies: 5 Views: 621 Firstly, your indentation is pretty bad. I lost the flow at the middle of the code.
Secondly, use int main().
I think this is wrong:
if (cMenu = 1); // statment for if cMenu is true
You are... |
Forum: C Dec 13th, 2008 |
| Replies: 6 Views: 574 Small correction: The variable 'm' doesn't hold the value of the smallest element, but it holds the index of the smallest element in the array. |
Forum: C Dec 13th, 2008 |
| Replies: 6 Views: 574 The algorithm in use is selection sort (http://en.wikipedia.org/wiki/Selection_sort)[wikipedia.org]. It's one of the simplest sorting techniques.
It's algorithm is:
1. Find the smallest element... |
Forum: C Dec 13th, 2008 |
| Replies: 3 Views: 2,314 Read the reply for your previous post and stop trolling around. |
Forum: C Dec 13th, 2008 |
| Replies: 5 Views: 963 Daniweb isn't a program spewing machine that you can command. |
Forum: C Dec 13th, 2008 |
| Replies: 7 Views: 862 C language was developed by Dennis Ritchie, but I'm not sure if he's officially recognized as the 'Father of C language'. That said, don't post a thread as if you are at a gun-point. All those... |
Forum: C Dec 13th, 2008 |
| Replies: 3 Views: 530 After 8 posts, the community expects you to know how to use code tags. Click here (http://www.daniweb.com/forums/thread93280.html) |
Forum: C Dec 9th, 2008 |
| Replies: 7 Views: 1,925 If you're reading from a text file, you can use fscanf() to read in the numbers. And it's not necessary to prefix the numbers with a 0x, although for convenience's sake, you can.
Ex: Let's say... |
Forum: C Dec 7th, 2008 |
| Replies: 2 Views: 628 Use code tags for your code
.
.
.
Your code here
.
.
. |
Forum: C Dec 5th, 2008 |
| Replies: 7 Views: 1,925 I (and probably others too) don't fully understand your problem. How can the following be "working fine" for you?
char * hex = (..dynamically allocated memory with malloc..);
And you haven't... |
Forum: C Dec 5th, 2008 |
| Replies: 4 Views: 640 Here's a useful link (http://www.java2s.com/Code/C/Development/Howtochecktheperformancedifftime.htm) |
Forum: C Dec 4th, 2008 |
| Replies: 4 Views: 528 This is wrong:
for(i = 0; i < n; i++){
for(j = 0; j < n; j++) printf(" %d", MatrixMult( a, b, c, &n ));
printf("\n");
}
You can't return arrays since they are always passed by... |
Forum: C Dec 4th, 2008 |
| Replies: 4 Views: 528 Better use fscanf() to read integers. If you use fgetc(), you'll be reading the ascii values of the integers and not their actual values. Also every digit will be treated as a character. How will you... |
Forum: C Dec 4th, 2008 |
| Replies: 10 Views: 995 That's quite a complex piece of code you got there. Since I'm still a beginner it took me quite a while to understand it's logic. I'm just surprised that you could come up with that logic and not be... |
Forum: C Dec 4th, 2008 |
| Replies: 10 Views: 995 Hmm. I guess I misjudged the working of fgetc(stdin). Will look that up. |