Posts
 
Reputation
Joined
Last Seen
Ranked #264
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
~51.3K People Reached
Favorite Tags
c x 143
java x 2
c++ x 1

83 Posted Topics

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
162
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
441
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
327
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
972
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
161
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
140
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
208
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
324
Member Avatar for s-a-n-d-e
Member Avatar for Salem
0
174
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
161
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
139
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
145
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
269
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
155
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
168
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
125
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
181
Member Avatar for rohanvijay
Member Avatar for ajay.krish123
0
92
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
139
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
728
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
135
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
654
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
470
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
135
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
Member Avatar for supersabre

Use code tags for your code [noparse][code=c] . . . Your code here . . . [/code][/noparse]

Member Avatar for supersabre
0
304
Member Avatar for Erikmmp

Here's a useful [url=http://www.java2s.com/Code/C/Development/Howtochecktheperformancedifftime.htm]link[/url]

Member Avatar for Erikmmp
0
127
Member Avatar for Dewey1040

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 read multiple-digit numbers then? Also you've used [icode]n = fgetc(fin)[/icode]. Is that what you …

Member Avatar for Dewey1040
0
151
Member Avatar for Dewey1040

[QUOTE]My issue is that don't know how to keep prompting the user until the sentence is ended with a period. [/QUOTE] This is all you have to do to prompt the user till he enters a string with a period: [CODE=c] char msg[50]; int length = 0; do { printf("Enter …

Member Avatar for Dewey1040
0
206
Member Avatar for Demonisya

[QUOTE=yuvaraj.tr;736435]for(i=0;i<5;i++) { for(j=0;j<=i;j++) { printf("*\n"); } }[/QUOTE] That doesn't do any good. [QUOTE=Demonisya ]Create a program that could show this output * *** **** ****** [/QUOTE] Are you sure about the output? 1st row should have 1 asterisk, 2nd row should have 3, 3rd should have 4 and 4th row …

Member Avatar for Demonisya
0
174
Member Avatar for java_girl
Member Avatar for devnar
0
11K
Member Avatar for raja289

[QUOTE=Salem;748556] Not to mention, the unindented code which is simply awful to look at.[/QUOTE] Second that. Also, flow of the code is confusing which is really awful considering the simplicity of the problem. main returns an integer. So it's [icode]int main()[/icode] not just [icode]main(void)[/icode]. This test condition is wrong: [code]else …

Member Avatar for devnar
0
120
Member Avatar for Erikmmp

More info [url= http://www.cprogramming.com/tutorial/random.html]here[/url] and [url=http://eternallyconfuzzled.com/arts/jsw_art_rand.aspx]here[/url].

Member Avatar for Erikmmp
0
123
Member Avatar for riahc3
Member Avatar for Creator07

Appending a new employee to the should be easy. Declare a few "templates"(poor choice of word, perhaps) of string such as: [code=c] char empInfoTemp[] = "Employee "; char nameTemp[]= " Name : "; . . .[/code] Now prompt the user for employee information and get that using fgets(). Then use …

Member Avatar for devnar
0
109
Member Avatar for IrishUpstart

Read the doubles from the file in this way: [code=c]while(fscanf(input,"%lf", &x[N]) == 1)[/code] Even the previous code should work. Dunno why it crashed on your system. Also there's no error proofing in your code. What if there aren't 5 entries in the file? You gotta display a suitable error msg. …

Member Avatar for devnar
0
93
Member Avatar for atman

You declare a pointer within a function if you're gonna use it only within the function. If you wanna pass arguments to the function whose value you want processed within the function then you pass their addresses. In your ex, you're passing grade1 and grade2's addresses since you're processing them …

Member Avatar for devnar
0
288
Member Avatar for msundastud

[QUOTE]this one has me stumped, I'm not even sure where to begin[/QUOTE] You've listed the whole algorithm necessary for solving both the programs. There isn't much left to think about. Anyway, your decrypt function looks something like this: [CODE=c]void decrypt(char input[]) { char output[20]; int i; for(i=0; input[i]!='\0';i++) // without …

Member Avatar for devnar
0
118
Member Avatar for atman

You declare it as an integer. Ex: [CODE]int hex = 0xBCD; printf("%x",hex);[/CODE]

Member Avatar for devnar
0
88
Member Avatar for sambafriends

This is your 14th post, and you still don't bother to use code tags. Also it was mentioned quite a lot of times in your [url=http://www.daniweb.com/forums/thread154910.html]previous thread[/url] that you should use [icode]int main[/icode] instead of [icode]void main[/icode].

Member Avatar for devnar
0
135
Member Avatar for sambafriends

1. [B]struct num[/B], not strunct 2. If compiling in C, then [icode]struct num n1; struct num* p;[/icode] 3. [icode]p = &n1[/icode]

Member Avatar for sambafriends
0
277
Member Avatar for c_skyscraper

MNTABPTR is only a pointer whose size is 4 bytes(32-bit system). What you want is to allocate memory for the size of the structure MNT which is 132 bytes. For which you either do this: [CODE]newnode = (MNTABPTR)malloc(sizeof(*newnode));[/CODE] or this: [CODE]newnode = (MNTABPTR)malloc(sizeof(MNT));[/CODE]

Member Avatar for c_skyscraper
0
119
Member Avatar for The Dude

[QUOTE=Ezzaral;741583]The hate mail section is the best.[/QUOTE] Yeah, that was a real hoot. :)

Member Avatar for jbennet
0
57
Member Avatar for dusse

Also, in C, shouldn't [icode]node *x;[/icode] be [ICODE]struct node *x;[/ICODE]? Another note - main returns int.

Member Avatar for Narue
0
218
Member Avatar for BigFormat

malloc() always returns a void pointer. You need to typecast it. [icode]students = (struct student**)malloc(sizeof(struct student));[/icode]

Member Avatar for Clockowl
0
3K

The End.