Search Results

Showing results 1 to 40 of 71
Search took 0.01 seconds.
Search: Posts Made By: Alibeg
Forum: C Sep 14th, 2009
Replies: 6
Solved: Return an array
Views: 592
Posted By Alibeg
there is a way to make a pointer and then edit the content of what that pointer points to using a function:


void func (char *p)
{
p[index_of_element] = 'A';
.....
}

int main(void)
Forum: C Sep 11th, 2009
Replies: 6
Solved: Return an array
Views: 592
Posted By Alibeg
you can also make a global variable and edit its contents in your function, so you wont be in need of returning anything


to dynamically allocate you can:

#include <stdio.h>

char *function...
Forum: C Aug 12th, 2009
Replies: 3
Views: 329
Posted By Alibeg
ok...i think i've found the problem...
problem occured at nearly the same place even if i doubled or tripled the size of the array...
it seems that recursion is the main problem because with some...
Forum: C Aug 12th, 2009
Replies: 3
Views: 329
Posted By Alibeg
ok....but i dont get it....i have a debug print to tell me how far am i from the end of the array and Segmentation Fault happens to occur some 1000 array elements before the end of the array...(and i...
Forum: C Aug 11th, 2009
Replies: 3
Views: 329
Posted By Alibeg
Hi guys....i have a problem and I hope you can explain me where am I wrong...

I am doing some kind of Breadth First Search (BFS) ("some kind of" because this is my first program to use this...
Forum: C Jul 25th, 2009
Replies: 30
Views: 1,622
Posted By Alibeg
being able to modify something depends whether your pointer allows it and whether you string allows it.

if you declare pointer like char const *p; you can only use it for reading and accessing...
Forum: C Jul 25th, 2009
Replies: 7
Views: 541
Posted By Alibeg
You can try to run through the whole AA array using a loop and then copy the index (character) of each element that has value 0 (one referring characters that dont appear in input text) to the end of...
Forum: C++ Jul 24th, 2009
Replies: 13
Solved: dayOfYear
Views: 540
Posted By Alibeg
And it works?
I mean, there should be a part where you add one day to the dayNum when you have a leap year, and dayNum += numOfDaysInMonth[i-1];
should be executed regardless of the leap year (so...
Forum: C++ Jul 23rd, 2009
Replies: 13
Solved: dayOfYear
Views: 540
Posted By Alibeg
ok...this guy gave you the answer and here's the explanation

you have made it a bit too complicated, and that's where you've made a mistake

look here (your code):

if((i >= 3 && i <= 12) &&...
Forum: C Apr 9th, 2009
Replies: 5
Solved: structures
Views: 285
Posted By Alibeg
thanks, this is solved :D
Forum: C Apr 9th, 2009
Replies: 5
Solved: structures
Views: 285
Posted By Alibeg
one more question:
in your definition of structure (one with typedef) you didnt declere variables, if i wanted to make some i would type foo arrayOfTypeStructFoo[10]; somewhere later
am i right?
Forum: C Apr 9th, 2009
Replies: 5
Solved: structures
Views: 285
Posted By Alibeg
i wanted to write:

void swap ( mystructure *a, mystructure *b )
{
mystructure *temp = a;
a = b;
b = temp;
} but my head was going to blow since im so tired
i actually wanted to...
Forum: C Apr 9th, 2009
Replies: 5
Solved: structures
Views: 285
Posted By Alibeg
i am facing several problems....

first one is: how do i typedef a structure
i've seen many ways to do it but im not quite sure which one is the right one.
this is what i think how it goes (but...
Forum: C Mar 25th, 2009
Replies: 1
Views: 218
Posted By Alibeg
i need something from standard libraries that can help me outputting chars at specific places on my screen...i have seen some commands defined in conio.h but i cannot use it as my compiler doesnt...
Forum: C Mar 25th, 2009
Replies: 10
Views: 721
Posted By Alibeg
adress book aplication with all possible details?
Forum: C Mar 25th, 2009
Replies: 3
Views: 363
Posted By Alibeg
read the answer on the other thread
and dont post your problems multiple times as you probably wont get answer if you do so
Forum: C Mar 25th, 2009
Replies: 3
Views: 363
Posted By Alibeg
please use those first three threads in this forum for that
thanks
Forum: C Mar 21st, 2009
Replies: 1
Views: 265
Posted By Alibeg
int **p;
p = malloc (x * sizeof *p);

sizeof *p - (i am not quite sure, and i was thinking) does it calculate the size of *p as size of double pointer, size of pointer or as size of variable...
Forum: C Mar 20th, 2009
Replies: 15
Views: 661
Posted By Alibeg
while you was posting last one i edited previous post - sorry
i wrote whole bunch of unnecessary things in first version of post
Forum: C Mar 20th, 2009
Replies: 15
Views: 661
Posted By Alibeg
yeah....im asking because im still in process of extensive learning and everything compiler specific that i hear is bad.
i will stick to old fashioned method (it seems that i had to cast malloc to...
Forum: C Mar 20th, 2009
Replies: 15
Views: 661
Posted By Alibeg
heh...i found this:
http://gcc.gnu.org/c99status.html
looks like i cannot declare variable-length arrays and this is one of the things i had no clue about
thanks again for all spent time and given...
Forum: C Mar 20th, 2009
Replies: 15
Views: 661
Posted By Alibeg
i didn ignore...im just trying to figure the other way suggested by kenji (easier one XD)

now im puzzled, maybe because in school i learn c and c++, their combination actually, so i dont know what...
Forum: C Mar 20th, 2009
Replies: 15
Views: 661
Posted By Alibeg
i think i understand this method but im actually surprised that variable length feature doesnt work on my comp because im using minGW GCC that comes with newest version of CodeBlocks (28 Feb 2008)....
Forum: C Mar 20th, 2009
Replies: 15
Views: 661
Posted By Alibeg
it doesnt seem to work...prototyping it with:
void harvest (int farm[m][n],...); gives an error from compiler:
'm' was not declared in this scope
'n' was not declared in this scope
and few more...
Forum: C Mar 19th, 2009
Replies: 15
Views: 661
Posted By Alibeg
ok.....i new to these things...so i am making huge mistakes
i need to pass a two dim array...so how to pass it?
(btw can you tell how to pass a double pointer)

from what you said...it seems that...
Forum: C Mar 19th, 2009
Replies: 15
Views: 661
Posted By Alibeg
i have problem passing double pointer to my funciton
first i declare:
int m, n;
i read m and n from user just fine (i've checked that)
then i declere:
int farm[m][n];

and i have a function......
Forum: C Mar 5th, 2009
Replies: 13
Views: 639
Posted By Alibeg
you mean...you can if you make a 2dim array, not just one dimensional array, because in that case (case of 1dim array) stu_name[i] is just a char variable, not a pointer and you cannot use scanf...
Forum: C Mar 5th, 2009
Replies: 13
Views: 639
Posted By Alibeg
thanks...i know what you are talking about...and i know that we need to use 2-dimensional array in this case...but i was just saying that you must pass a pointer to array and not just single cell in...
Forum: C++ Mar 4th, 2009
Replies: 2
Solved: CodeBlocks
Views: 1,255
Posted By Alibeg
thank you....i first did
sudo apt-get install c++, becuse i already had newest version of gcc, but as many suggested i also did sudo atp-get install build-esential...
work perfectly......
Forum: C Mar 4th, 2009
Replies: 13
Views: 639
Posted By Alibeg
@csurfer
i thought that you cannot read a string like scanf ("%s", stu_name[j]); if you defined stu_name like char stu_name[MAX_LENGTH];
Forum: C++ Mar 3rd, 2009
Replies: 8
Views: 280
Posted By Alibeg
did you check if you wrote it the same way as your teacher said?
maybe you are missing some part of it.
(maybe teacher is wrong? XD joke)

do you have to use exactly the same algorithm as your...
Forum: C++ Mar 3rd, 2009
Replies: 8
Views: 280
Posted By Alibeg
here's your problem:

x = floor( x * pow(10.0, n) + 0.5 / pow(10.0, n));
return x;

you forgot to divide x with 10^n after you finished rounding
and im not quite sure what is that 0.5 / pow...
Forum: C++ Mar 3rd, 2009
Replies: 2
Solved: CodeBlocks
Views: 1,255
Posted By Alibeg
I ve just installed ubuntu intrepid ibex (8.10.) on my laptop
i have been using it for a while already but i just wanted to clear the system completely so i installed it, put some updates, some...
Forum: C Mar 3rd, 2009
Replies: 13
Views: 639
Posted By Alibeg
calm down...having that stance may only make someone angry.


printf ("Enter your Name");
scanf ("%s", stu_name [10]);

scanf ("%s", stu_name); - this is correct way of reading a string (when...
Forum: C Feb 17th, 2009
Replies: 12
Views: 1,690
Posted By Alibeg
hahahaha! you're the man...yes i did save it as Prog, but i forgot that Code::Blocks wont add extension by itself so it treated my source code as a text file or i dont know what (my only excuse is...
Forum: C Feb 17th, 2009
Replies: 8
Views: 779
Posted By Alibeg
no prob, just dont forget to give the credits to a man who gave you the formula in the first place ;) (nmaillet)
Forum: C Feb 17th, 2009
Replies: 8
Views: 779
Posted By Alibeg
double pass2 = a; //where a is angle between line (first point of polygon joined with centre of polygon) and x axis.....you might like to set pass2 to 0 in the beginning
while(k<n*2)
{
...
Forum: C Feb 17th, 2009
Replies: 8
Views: 779
Posted By Alibeg
a is constant, but n*pass changes because n changes
i dont know why do you use double pass = 360 / n
and after that pass2 = n * pass, do you mean pass2 = 360?
and why do you use _n?
dont forget...
Forum: C Feb 17th, 2009
Replies: 12
Views: 1,690
Posted By Alibeg
i know this should have been C++ but when i started i didnt have a clue whether it was c or c++ compiler (I could have posted a new thread but it seemed aggressive)
Diagnostics:
3: Syntax error:...
Forum: C Feb 15th, 2009
Replies: 12
Views: 1,690
Posted By Alibeg
#include <iostream.h>

int main ()
{
std::cout << "Welcome to C++ programming!\n";
return 0;
}

wont compile on Code::Block on ubuntu Intrepid Ibex
says:
Showing results 1 to 40 of 71

 


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

©2003 - 2009 DaniWeb® LLC