Search Results

Showing results 1 to 40 of 130
Search took 0.02 seconds.
Search: Posts Made By: Aia ; Forum: C and child forums
Forum: C 6 Days Ago
Replies: 8
Views: 259
Posted By Aia
-ansi switch, all that it does is to support the C89 features and disable the GNU extensions that conflict with C89, but it doesn't mean that it will make gcc compiler to behave as a strict ANSI...
Forum: C 12 Days Ago
Replies: 5
Solved: char in c?
Views: 331
Posted By Aia
scanf("%f", &length);
length is an int, you are passing a float. Same with scanf("%f", &breadth);
Either you change the type in the declaration of length and breadth, or change the f to d in the...
Forum: C 17 Days Ago
Replies: 4
Views: 289
Posted By Aia
Read the comments I added to your source code.

Of course if you were looking to assign the values of the structure poly p at declaration time, then it would have been:
struct poly p = { 45, { 1,...
Forum: C 17 Days Ago
Replies: 9
Views: 349
Posted By Aia
If you would take a little time to understand the information I gave you via links, in the second post, you probably would have not need to ask that question.
Forum: C 17 Days Ago
Replies: 9
Views: 349
Posted By Aia
Or up and down. It doesn't matter. It is undefined behavior.
If a plane doesn't have a pilot, it doesn't matter if people speculate about the capacity of fuel tanks to make the trip, or the...
Forum: C 17 Days Ago
Replies: 9
Views: 349
Posted By Aia
Click here (http://www.daniweb.com/forums/post1048411.html#post1048411) and here (http://www.daniweb.com/forums/post1049104.html#post1049104).
Forum: C 17 Days Ago
Replies: 6
Views: 425
Posted By Aia
Expressions has direct effects and side effects.
This expression, x = y; has a direct effect of copying the computed value of y assigning it to the location x.

x = a[i]; has a direct effect as...
Forum: C 18 Days Ago
Replies: 4
Views: 290
Posted By Aia
I knew there was more to it than what you stated previously.
What you wanted to know is if a void function can be use as the stop control for a loop. And the answer is ... no. There's nothing for...
Forum: C 18 Days Ago
Replies: 4
Views: 290
Posted By Aia
Yes, why do you ask? There must be something else you want to know.
Forum: C 18 Days Ago
Replies: 2
Views: 227
Posted By Aia
Instead of out = fopen (out, "w");
it must be out = fopen ( filename, "w" ); where filename is a string with the path to the file you want to write.
Remember, when you use the "w" if the file...
Forum: C 18 Days Ago
Replies: 6
Views: 425
Posted By Aia
Those two expressions invoke undefined behavior. Anything can be the result.
It is best if you write int main(), and return inside of main to comply with the standard.
Forum: C 18 Days Ago
Replies: 3
Views: 301
Posted By Aia
There's not such a mechanism of translating C to Java, except for the most rudimentary and simple statements. Since both languages are different, all that it can be done is to understand what the...
Forum: C 18 Days Ago
Replies: 4
Views: 295
Posted By Aia
Variable str is created when the function leer() is used. It is [1]destroyed when the function leer() is finished. You are returning a pointer to that memory that might or might not contain the...
Forum: C 22 Days Ago
Replies: 6
Views: 351
Posted By Aia
Nope. More like:

struct amicable *record;

/* record must point to some memory before using it */
record = &a_struct_amicable_block_of_memory; /* can be done with malloc */
Forum: C 22 Days Ago
Replies: 10
Views: 358
Posted By Aia
:) segmentation faults occur when you are trying to access memory that you are not suppose to. e.g.
int *x; /* declares a pointer to int, the variable x is holding a random value which will be used...
Forum: C 22 Days Ago
Replies: 4
Views: 243
Posted By Aia
When you are the original poster you'd see at the bottom, after the last post, the mark as solved title, in blue. Click on it.
Forum: C 23 Days Ago
Replies: 10
Views: 358
Posted By Aia
char *c; is a pointer, again, it doesn't point to any proper memory allocated to it.
while(fgets(c, 600, fin)!=NULL)
Guess what you are trying to do there? Yeap! Trying to write to poor char *c...
Forum: C 23 Days Ago
Replies: 10
Views: 358
Posted By Aia
For some, memory management in C, is a curse, nevertheless it is one of the strength of the language.


After allocating memory for it, remove any & in front of those pointers to string like...
Forum: C 23 Days Ago
Replies: 10
Views: 358
Posted By Aia
struct REPLY *reply; is a pointer, anything you try to write to it it will produce a segmentation fault, since there's no memory allocated for it.
Forum: C 23 Days Ago
Replies: 8
Views: 304
Posted By Aia
shakunni >Anyone know why this is the case?
A function must be called from another function block which could be the main function or one with a lineage to any main function.
Meaning that main()...
Forum: C 25 Days Ago
Replies: 2
Views: 199
Posted By Aia
To save the transaction you are almost there.
int bal = 0; /* initialize balance to zero */

instead of bal = 0 + credit; replace for bal = bal + credit; or bal += credit; which is a shortcut.
Forum: C 26 Days Ago
Replies: 2
Views: 212
Posted By Aia
system("PAUSE"):
Forum: C 30 Days Ago
Replies: 4
Views: 192
Posted By Aia
It was intended to be a hint, rather that a question to answer.
Forum: C 30 Days Ago
Replies: 10
Views: 538
Posted By Aia
if( line == pattern)
That's a no-no, since line and pattern are strings and you can't compare arrays in that way.
Take a look at the string function strcmp() for that.
However, even if that would...
Forum: C 30 Days Ago
Replies: 4
Views: 192
Posted By Aia
if (data_size == SIZE_32 ) {
* ( ((int32_t*)(new_node->data)) + index) = (int32_t) index*2 ;
* ( ((int32_t*)(new_node-> data)) + index) = (int32_t) index*3;
}
else {
*...
Forum: C 30 Days Ago
Replies: 6
Views: 360
Posted By Aia
The controlling expression of a switch shall have integer type.
An array of chars will not do.
Forum: C 32 Days Ago
Replies: 4
Views: 267
Posted By Aia
It doesn't matter, if she follows your advise she will get a square.


Then you'll learn nothing.

Some clue:
One loop inside another one as previously said.
Outer loop is the number of rows....
Forum: C 32 Days Ago
Replies: 2
Views: 243
Posted By Aia
First, you must understand what constitutes a string in C. It is a sequence of chars terminated with a '\0'.
So if I have this:
char fullname[] = "Jiminy Cricket";
and I want to split it into name...
Forum: C 34 Days Ago
Replies: 11
Views: 481
Posted By Aia
In the C89 standard, an array must be set with a constant. Which would not allowed what you just did.
int cantidad_frases = 0;
printf("Cuantas frases quieres escribir?: ");
scanf("%d",...
Forum: C Oct 30th, 2009
Replies: 2
Views: 260
Posted By Aia
fgets( student[count_s].name, sizeof (student[count_s].name), stdin );
Forum: C Oct 28th, 2009
Replies: 2
Views: 207
Posted By Aia
Dear Sir/Madam:
Certainly, you made the right choice to select this forum to ask your C programming questions. Nevertheless, you skipped two important requirements that must accompany YOUR posting...
Forum: C Oct 28th, 2009
Replies: 7
Views: 498
Posted By Aia
void swap(int *num1, int *num2)
{
int tempvar1;

tempvar1 = *num1;
*num1 = *num2; /* learn the difference between num1 and *num1 */
*num2 = tempvar1;
}
Forum: C Oct 26th, 2009
Replies: 9
Views: 471
Posted By Aia
A brief explanation. (http://www.cprogramming.com/faq/cgi-bin/smartfaq.cgi?answer=1047673478&id=1043284351)
Forum: C Oct 24th, 2009
Replies: 9
Views: 471
Posted By Aia
Casting the return of dynamic memory allocation functions should not be made a habit of, in C. If the standard header file stdlib.h is included, there's not need of casting and it can avoid subtle...
Forum: C Oct 20th, 2009
Replies: 4
Views: 334
Posted By Aia
atoi() accepts a string as argument. Not a character i as it is in your code, nor a pointer to a char like you give it as in atoi(&i)

Something like:
char twenty_three[] = "23";
int result;
...
Forum: C Oct 11th, 2009
Replies: 5
Views: 477
Posted By Aia
Since you are not looking for a quick answer, this link (http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/ncal/ncal.c?rev=1.27.2.1;content-type=text%2Fplain) might give you an idea of the task.
Forum: C Aug 25th, 2009
Replies: 10
Views: 671
Posted By Aia
Your question revealed that perhaps you are not understanding what it has been explained so far.
There's not such a thing as call by reference in The C language. Everything done is done by coping...
Forum: C Aug 23rd, 2009
Replies: 6
Views: 458
Posted By Aia
EvilOrange> <--Line 27 - proving the scanf("%s", &tmpfilename) is working
Dealing with the format %s in scanf() you must pass the argument as plain tmpfilename or as &tmpfilename[0], but not as...
Forum: C Aug 23rd, 2009
Replies: 6
Views: 458
Posted By Aia
On the phone
Nick: Doctor, can you cure my cough? It is a horrible cough, I cannot sleep at night.
Dr. Hell: Sorry, Nick, I cannot prescribe the proper medication without seeing you first, make an...
Forum: C Aug 6th, 2009
Replies: 13
Solved: Return 0;
Views: 759
Posted By Aia
no1zson> What is wrong with GOTO?
It usually is misused and it has the potential of making any code hard to debug and maintain.

no1zson> What would you suggest in its place?
Ideally, a sharp...
Showing results 1 to 40 of 130

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC