Posts
 
Reputation
Joined
Last Seen
Ranked #263
Strength to Increase Rep
+8
Strength to Decrease Rep
-2
100% Quality Score
Upvotes Received
7
Posts with Upvotes
7
Upvoting Members
4
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
6 Commented Posts
~50.8K People Reached
Favorite Tags
c x 143
java x 2
c++ x 1
Member Avatar for devnar

I'm using the following swap function to swap two elements of an array. The element pointed to by 'x' and 'y' and the one right below it, to be particular (then i want x and y to point to the second of the swapped elements, hence i use auto increment). …

Member Avatar for anveshnaidu
0
160
Member Avatar for jared_masc

[QUOTE=jared_masc;715783]ok i have changed it to this, but m gettin a warning "comparison between pointer and integer" [CODE] int getInputByscanf(char input[]){ char string[4]; int result; result = scanf("%c", &string); while (string != EOF) string = scanf("%c", &string); System("Pause"); return 0; } [/CODE][/QUOTE] You still haven't pointed out why you are …

Member Avatar for deceptikon
0
5K
Member Avatar for Ungodlyrich

The upper limit of an int is 2147483647(32-bit system). When x reaches the value 1073741824, [icode]x<<1;[/icode] multiples that value by 2 which yields 2147483648 which is beyond the upper limit, hence the value goes in a circle and the number -2147483648 gets stored in x and consequently in m. since …

Member Avatar for newlearnerIV
0
9K
Member Avatar for rocketman03

[icode]b[j++]=((remainder-10)+'A');[/icode] This doesn't behave the way you want it to behave. I'm assuming that b[] is an array of integers. The above expression will only store ascii values of A,B,C,D,E,F. I suppose modifying your printf statement within the for loop will solve your problem. [code=c]for( j = count-1 ; j …

Member Avatar for WaltP
1
424
Member Avatar for staufa

[icode]string[i]=getchar();[/icode] I don't think this will work properly. getchar() expects you to hit enter after the input of each character which means that '\n' will be left in the input buffer which will be read the next time getchar() executes. Which means that each character will alternate with a '\n'. …

Member Avatar for cthoes
0
323
Member Avatar for devnar

Hi, I'm trying to call a bunch of methods during run-time using reflection, but I'm getting an exception saying "IllegalArgumentException: wrong number of arguments". Here's some information on the variables used. - All elements of mailTestClass[] are classes that extend AbstractTestCase. (FirstTestCase extends AbstractTestCase and FirstTestCase.class is the first element …

Member Avatar for devnar
0
960
Member Avatar for rohanvijay
Member Avatar for Eko

On related topic, you may find [url=http://www.daniweb.com/forums/thread145177.html]this[/url] thread interesting. ArkM has explained floating pont conversions pretty well.

Member Avatar for dwayneb
0
5K
Member Avatar for caroll

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 the row elements and store it in rowAdd, see if the elements of rowAdd …

Member Avatar for devnar
0
157
Member Avatar for lonely_girl

Use int main(), indent your code, use switch cases and a while loop instead of goto and if cases.

Member Avatar for lonely_girl
0
137
Member Avatar for orthographer

You gotta use code tags for people to consider answering to your post. Here's the syntax: [noparse][code=c] . . your code here . . [/code][/noparse] Anyway, just a cursory glance through your code showed a few big mistakes: 1. Use int main() 2. You are using %c to get a …

Member Avatar for WaltP
0
206
Member Avatar for orthographer

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. [CODE=c]#include <stdio.h> #include <conio.h> #include <string.h> int main() { char *loginID[] = {"user1", "user2", "user3"}; char …

Member Avatar for orthographer
0
321
Member Avatar for s-a-n-d-e
Member Avatar for Salem
0
172
Member Avatar for drjay1627

You can also look up [url=http://en.wikipedia.org/wiki/RSA]RSA[/url] or [url=http://en.wikipedia.org/wiki/Data_Encryption_Standard]DES[/url] if you are dealing with delicate data. But they are both quite complicated to implement (compared to Caesar cipher and rot13).

Member Avatar for drjay1627
0
158
Member Avatar for phoniel

The if statement is wrong. It should be: [CODE=cpp]if (pow > 1) { full = num * full; return (power(num, --pow, full)); //You've already multiplied once. Don't do it again. }[/CODE] Also, your code breaks when pow = 0. Anyway, it's an easy thing to fix.

Member Avatar for devnar
0
135
Member Avatar for ahspats

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: [CODE=c]liste_t* Insert (liste_t *listptr, int val) { liste_t *lp = listptr; liste_t *prev = NULL; liste_t *info = (struct liste_t *) …

Member Avatar for Luckychap
0
138
Member Avatar for kikloo

[QUOTE]char dd[1];[/QUOTE] That's wrong. You're allocating memory for only one character. Should be dd[2]. [QUOTE]aa[] = dd[0] + dd[1];[/QUOTE] This statement adds the ASCII values of '2' and '3'. So your result will be 50(ASCII value of 2) + 51(ASCII value of 3). And the result can't be just assigned …

Member Avatar for Murtan
0
265
Member Avatar for amit.turkaspa
Member Avatar for Anamika1

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 'URGENT! URGENT! HURRY!' cries will only succeed in putting people off. Also search the …

Member Avatar for galaxyweblinks
0
152
Member Avatar for m24r

What's [icode]glblclrtab[/icode] 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 [icode]*(glblclrtab+i)= (char) i1;[/icode] or [icode]glblclrtab[i]= (char) i1;[/icode] for simplicity. By the way, use code tags while posting your code.

Member Avatar for death_oclock
0
167
Member Avatar for IrishUpstart

The algorithm in use is [url=http://en.wikipedia.org/wiki/Selection_sort]selection sort[/url][wikipedia.org]. It's one of the simplest sorting techniques. It's algorithm is: 1. Find the smallest element in an unsorted array. 2. Swap it with the value at the first position for the current iteration. 3. Repeat this procedure n-1 times. (n being the no …

Member Avatar for ajay.krish123
0
123
Member Avatar for RenFromPenn

The same program works fine in my compiler (code::blocks using GCC). It prints the line "Sum of all elements = %d" too.

Member Avatar for devnar
0
177
Member Avatar for rohanvijay
Member Avatar for ajay.krish123
0
89
Member Avatar for Jawahar prabhu

After 8 posts, the community expects you to know how to use code tags. Click [url=http://www.daniweb.com/forums/thread93280.html]here[/url]

Member Avatar for ajay.krish123
0
137
Member Avatar for suley04

It was already explained to you by Ancient Dragon in your [url=http://www.daniweb.com/forums/post759666-2.html]previous thread.[/url]

Member Avatar for ajay.krish123
0
725
Member Avatar for god_43

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: [CODE]if ([COLOR="Red"]cMenu = 1[/COLOR]); // statment for if cMenu is true[/CODE] You are using an assignment operator instead of '==' operator. The else part of …

Member Avatar for dbmoyes
0
132
Member Avatar for simone.marras

You can use the [url=http://www.cplusplus.com/reference/clibrary/cassert/assert.html]reference[/url] if you aren't sure of how the assert function works. I think in your program, you've to "assert" that the value of the variable _inode stays within 0 to 3 and this has to be done in the for loop. If the value of that …

Member Avatar for devnar
0
646
Member Avatar for suley04

[QUOTE]can you please just explain why you added [i] in those positions within the for loop, because when i replaced my original code with them, i got 4 errors, all the same.[/QUOTE] [icode]struct sale Weekly_Sale[13];[/icode] What you're doing here is creating a user-defined variable called Weekly_Sale of type 'struct sale'. …

Member Avatar for Ancient Dragon
0
467
Member Avatar for CoolAtt

You're missing a semi-colon after defining the struct. Should be: [CODE]struct names{ // definitions ----- ---- ---- }[COLOR="Red"];[/COLOR][/CODE]

Member Avatar for ArkM
0
132
Member Avatar for CoolAtt

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 explained your problem well enough, either. Here's what i understood it as: You have two character arrays-str1 and str2. …

Member Avatar for Murtan
0
1K