Posts
 
Reputation
Joined
Last Seen
Ranked #490
Strength to Increase Rep
+4
Strength to Decrease Rep
-1
92% Quality Score
Upvotes Received
14
Posts with Upvotes
13
Upvoting Members
9
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
4 Commented Posts
0 Endorsements
Ranked #2K
~15.7K People Reached
Favorite Forums
Favorite Tags
Member Avatar for walas

You said "founded some errors" ... what did you find? I recommend adding some debug code, for example, to print or check validity of the entire linked list after every operation.

Member Avatar for syker111
0
617
Member Avatar for NH1
Member Avatar for Riebens
0
179
Member Avatar for danswater

Did you want to access the first integer in a string? or the first character in an integer? :-) How about the first integer in an array of integers?[CODE] int myarray[10] = {1,2,3,4,5,6,7,8,9,10}; printf("%d\n", myarray[0]); printf("%d\n", *myarray); printf("%d\n", myarray[5]); int *p; p = myarray; printf("%d\n", *p++); printf("%d\n", *p++); p = …

Member Avatar for danswater
0
96
Member Avatar for akvilio

Your original code was pretty good, but it does not change the value of "i" (i/10 doesn't do anything). It should be i = i/10 or i /= 10 (which is not as readable). printf() needs a newline "\n" in it. Also the function should return immediately when a match …

Member Avatar for akvilio
0
118
Member Avatar for johndoe444

The problem is not the malloc() statement, but in some other code which is corrupting the heap (= the space owned by malloc()). I would run the code in the debugger, but I can't because it isn't complete; do that if you can. If that isn't feasible, you can strip …

Member Avatar for UncleLeroy
0
138
Member Avatar for Akash Mujumdar

I do not have the same compiler, but ... Each user-configuration (equivalent of Visual Studio .proj project file) has an option to disable the default path. Make sure the equivalent option is set correctly for your compiler. The message is not complaining that it can't find the file, it is …

Member Avatar for UncleLeroy
0
163
Member Avatar for viwenka

The proposed solutions are limited to integers on the input, about making the maximum input value approximately 1111111111, which (interpeted in binary) is 1023. As homework, that would be a "C" grade. A better solution would be to read the input as a string, accepting up to 32 characters, where …

Member Avatar for UncleLeroy
0
193
Member Avatar for newbiecoder

Try something like this: [CODE]x = low_number + (high_number - low_number) * (rand() / RAND_MAX) / 2.0;[/CODE] If you need more help, follow the policy of this forum, by writing some code yourself, and do not continue to ask for help without showing any effort on your part.

Member Avatar for arkoenig
0
424
Member Avatar for arsenal_fan

6-byte alignment is rare, I assume you want a generic reply. It could depend on integer divide, which always truncates (never rounds). Avoid negative numbers by using unsigned. The first problem is the length of a pointer, which can be up to 64 bits long. Here is a generalized example[CODE] …

Member Avatar for arsenal_fan
0
223
Member Avatar for Grusky

If you are programming in C++ you should not be writing your own linked-list code. There are a number of built-in or free container classes available for that purpose. Writing your own linked list (except to learn why you should not do it), is a waste of time since the …

Member Avatar for daviddoria
0
132
Member Avatar for kevinyu

Just like if you were doing it on paper, you need to remember the numbers that were entered, and then process them after you have all of them. So you need some kind of a container (such as an array). Use one loop to enter the data into the container, …

Member Avatar for kevinyu
0
102
Member Avatar for eslmz

sizeof() is not an issue if you use ->next as recommended above, however, here are some details: 1) sizeof() is returning the number of bytes you used (4 + 15 + 4 + 4) = 27, but the compiler rounds up to a multiple of 3, 8, 16, or 32, …

Member Avatar for UncleLeroy
0
125
Member Avatar for Xpress2010

Read the forum rules, you are not allowed to ask other people to do your homework for you.

Member Avatar for UncleLeroy
0
96
Member Avatar for MrNoob

You should solve the other (winsock library) problem. Loading the library dynamically causes all kinds of "weirdness", leading to unreadable and hard-to-maintain code. The typedef would be something like [CODE]typedef __stdcall struct hostent * (*)(const char *) p_gethostname;[/CODE] The macro name DECLARE_STDCALL_P suggests __stdcall may be appropriate.

Member Avatar for UncleLeroy
0
95
Member Avatar for johndoe444

memcpy seems to be doing exactly what it was asked to do, ie. copy exactly 3 characters, 'b' 'i' 't', on top of a buffer which already contains 5 characters, 'b' 'b' 'i' 't' '\0' (note the null terminator). Only the first 3 characters are changed. To include the terminator, …

Member Avatar for UncleLeroy
0
2K
Member Avatar for jskelly

Storing a string as an integer (array element) does not work here [CODE] taMsgOut->data[6] = (Uint32)Test_Date; [/CODE] for 2 reasons (a) casting a string pointer to an int will transmit the pointer, but not the actual string (that the pointer points toward), resulting in garbage, or worse. (b) the 4-byte …

Member Avatar for UncleLeroy
0
165
Member Avatar for theABCasian

[CODE] for (int i = 0; i < strlen(line); i++) { line[i] = transform(line[i]); } line[i] = '\0'; // Bug: this line is missing string strLine = line;[/CODE]

Member Avatar for Ketsuekiame
0
265
Member Avatar for hetalraithatha

Assuming you have a C compiler for a DLX (whatever that is), this is trivial, since most C conpilers (all the ones I have ever seen) have an option to save the assembly language output to a file. This takes advantage of the way many compilers are written, ie. they …

Member Avatar for UncleLeroy
-1
560
Member Avatar for notuserfriendly

One of the rules on this site is: Do not post homework problems expecting a quick answer without showing any effort yourself. The posted code does not show any effort toward creating a 1D array.

Member Avatar for notuserfriendly
0
375
Member Avatar for mr.confused!

One of the rules on this site is: Do not post homework problems expecting a quick answer without showing any effort yourself. What do you have so far?

Member Avatar for UncleLeroy
0
112
Member Avatar for ajithasati

Older compilers and linkers would allow you to "clobber" the compiled-in strings, but newer compilers discourage it. It is not portable, but more important, it invites viruses since there is real code stored near the compiled-in string, which could be modified by overrunning the end of the array (referred to …

Member Avatar for abhimanipal
0
66
Member Avatar for leway

How about running the code in a debugger? (What compiler is it?) Other hints: line 61 reads one character. Line 64 stateCode[3] is beyond the end of the array. Line 64, "==" will never be true, use !strcmp().

Member Avatar for abhimanipal
-1
131
Member Avatar for krap_nek

This program is well organized, a good example for others using this forum. It has readable field names (such as "address"), and short, well defined functions that can be improved later without rewriting everything else. And I don't see any errors in the logic. It makes assumptions (array sizes, etc), …

Member Avatar for UncleLeroy
0
166
Member Avatar for nshh

I just answered this question in another thread, the answer was, essentially, "go to a bookstore, and buy a good book". Look at the books in person (as opposed to online) and pick one that explains the topics in a way that you can understand. Maybe that could be added …

Member Avatar for UncleLeroy
0
131
Member Avatar for lionaneesh

I recommend going into a large bookstore, or one which specializes in "Technical books". Check the index of the "Advanced C programming" books, until you find an book with a whole chapter on signals, that also makes sense to you. If no bookstore is available, walk into someone's office that …

Member Avatar for UncleLeroy
0
108
Member Avatar for colmcy1

The code is cut off at the end, but I don't see a problem. Try something simple, like below, and get it to work, before adding complexity. Also, use a short input file, with 4 lines in it, to start with, and add more lines after you get it working. …

Member Avatar for UncleLeroy
0
102
Member Avatar for rickymak

scanf is a function, not a variable, there should not be an = equal sign scanf=(something), if should be scanf(something);

Member Avatar for UncleLeroy
0
124
Member Avatar for Ammar1990

Since the number must be both even and a multiple of 7, it must therefore be a multiple of 14, [CODE] I = (I+13)/14; /* integer math rounds down */ I = I * 14; [/CODE] I put the statements on separate lines, for convenience in the debugger.

Member Avatar for Adak
0
115
Member Avatar for DCvonB

The assignment says to allocate in the function, and free() it in main. [CODE] void get_days_in_month(int **days, int year) { int *array = malloc(sizeof(int) * 5) ; /* Set the output variable */ *days = array ; /* do not increment either pointer (days or array) */ array[0] = 31 …

Member Avatar for Aia
0
145
Member Avatar for pramoda.ma

Trivial if the arrays are the same size. [CODE] int array1[10][100]; int array2[10][100]; array2 = array1; [/CODE]

Member Avatar for Ancient Dragon
0
5K